Skip to content

Commit 54f0894

Browse files
committed
Add pre-build checks and configuration for pre-commit hooks
1 parent ac43718 commit 54f0894

File tree

10 files changed

+157
-163
lines changed

10 files changed

+157
-163
lines changed

.github/dependabot.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
version: 2
3+
updates:
4+
- package-ecosystem: github-actions
5+
directory: /
6+
schedule:
7+
interval: weekly
8+
open-pull-requests-limit: 10
9+
groups:
10+
github-actions:
11+
patterns:
12+
- "*"
13+
update-types:
14+
- "minor"
15+
- "patch"

.github/workflows/release.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ name: Release
33
on:
44
push:
55
tags:
6-
- 'v*'
6+
- "v*"
77
workflow_dispatch:
88
inputs:
99
version:
10-
description: 'Version to release (e.g., v1.0.0)'
10+
description: "Version to release (e.g., v1.0.0)"
1111
required: true
1212
type: string
1313

@@ -21,7 +21,7 @@ jobs:
2121
runs-on: ubuntu-latest
2222
steps:
2323
- name: Checkout repository
24-
uses: actions/checkout@v4
24+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
2525

2626
- name: Validate version format
2727
run: |
@@ -49,7 +49,7 @@ jobs:
4949
needs: validate
5050
steps:
5151
- name: Checkout repository
52-
uses: actions/checkout@v4
52+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
5353
with:
5454
fetch-depth: 0
5555

@@ -85,7 +85,7 @@ jobs:
8585
echo "EOF" >> $GITHUB_OUTPUT
8686
8787
- name: Create GitHub Release
88-
uses: softprops/action-gh-release@v2
88+
uses: softprops/action-gh-release@5be0e66d93ac7ed76da52eca8bb058f665c3a5fe # v2.4.2
8989
with:
9090
tag_name: ${{ steps.version.outputs.version }}
9191
name: Release ${{ steps.version.outputs.version }}
@@ -116,7 +116,7 @@ jobs:
116116
needs: release
117117
steps:
118118
- name: Checkout repository
119-
uses: actions/checkout@v4
119+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
120120
with:
121121
fetch-depth: 0
122122

.github/workflows/test.yml

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,20 @@ on:
88
workflow_dispatch:
99

1010
jobs:
11+
pre-commit-check:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
15+
- uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
16+
- uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1
17+
1118
test-scripts:
1219
name: Test Scripts
1320
runs-on: ubuntu-latest
21+
needs: pre-commit-check
1422
steps:
1523
- name: Checkout repository
16-
uses: actions/checkout@v4
24+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
1725

1826
- name: Run unit tests
1927
run: ./test/run-tests.sh
@@ -42,9 +50,10 @@ jobs:
4250
test-action-check-mode:
4351
name: Test Action (Check Mode)
4452
runs-on: ubuntu-latest
53+
needs: pre-commit-check
4554
steps:
4655
- name: Checkout repository
47-
uses: actions/checkout@v4
56+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
4857

4958
- name: Create test config
5059
run: |
@@ -84,9 +93,10 @@ jobs:
8493
test-action-update-mode:
8594
name: Test Action (Update Mode)
8695
runs-on: ubuntu-latest
96+
needs: pre-commit-check
8797
steps:
8898
- name: Checkout repository
89-
uses: actions/checkout@v4
99+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
90100

91101
- name: Create test config
92102
run: |
@@ -122,12 +132,13 @@ jobs:
122132
test-action-with-pr:
123133
name: Test Action (PR Creation)
124134
runs-on: ubuntu-latest
135+
needs: pre-commit-check
125136
permissions:
126137
contents: write
127138
pull-requests: write
128139
steps:
129140
- name: Checkout repository
130-
uses: actions/checkout@v4
141+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
131142

132143
- name: Create test config
133144
run: |
@@ -170,9 +181,10 @@ jobs:
170181
test-fixtures:
171182
name: Test with Fixtures
172183
runs-on: ubuntu-latest
184+
needs: pre-commit-check
173185
steps:
174186
- name: Checkout repository
175-
uses: actions/checkout@v4
187+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
176188

177189
- name: Test with fixture files
178190
uses: ./

.github/workflows/upgrade-accessories-versions.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
actions: write
1717
steps:
1818
- name: Checkout repository
19-
uses: actions/checkout@v4
19+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
2020

2121
- name: Update Kamal accessories
2222
uses: ./

.mergify.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
pull_request_rules:
2+
- name: Merge Dependabot PRs on approval with [skip ci]
3+
conditions:
4+
- "#approved-reviews-by>=1"
5+
- or:
6+
- author=dependabot[bot]
7+
- author=github-actions[bot]
8+
actions:
9+
merge:
10+
method: merge
11+
commit_message_template: |
12+
{{ title | markdownify }} [skip ci]
13+
{{ body | markdownify }}
14+
queue_rules: []

.pre-commit-config.yaml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
repos:
3+
- repo: https://github.com/pre-commit/pre-commit-hooks
4+
rev: v6.0.0
5+
hooks:
6+
- id: fix-byte-order-marker
7+
- id: trailing-whitespace
8+
- id: end-of-file-fixer
9+
- id: mixed-line-ending
10+
- id: detect-aws-credentials
11+
args:
12+
- --allow-missing-credentials
13+
- id: detect-private-key
14+
- id: check-case-conflict
15+
- id: check-yaml
16+
args:
17+
- --allow-multiple-documents
18+
- id: check-json
19+
- id: check-xml
20+
- repo: https://github.com/python-jsonschema/check-jsonschema
21+
rev: 0.33.3
22+
hooks:
23+
- id: check-dependabot
24+
# - repo: https://github.com/adrienverge/yamllint.git
25+
# rev: v1.21.0
26+
# hooks:
27+
# - id: yamllint
28+
# args: [--format, parsable]
29+
# - repo: https://github.com/jumanjihouse/pre-commit-hook-yamlfmt
30+
# rev: 0.2.3
31+
# hooks:
32+
# - id: yamlfmt
33+
- repo: https://github.com/rbubley/mirrors-prettier
34+
rev: v3.6.2
35+
hooks:
36+
- id: prettier
37+
# types: [java, xml]
38+
additional_dependencies:
39+
- prettier@3.3.3
40+
- prettier-plugin-java@v2.6.4
41+
- "@prettier/plugin-xml@v3.4.1"
42+
args:
43+
- --write
44+
- --list-different
45+
- --ignore-unknown

.prettierrc.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
const config = {
2+
printWidth: 160,
3+
tabWidth: 2,
4+
useTabs: false,
5+
trailingComma: "none",
6+
requirePragma: false,
7+
plugins: [require.resolve("prettier-plugin-java"), require.resolve("@prettier/plugin-xml")]
8+
};
9+
10+
module.exports = config;

PR_REVIEW_RESPONSE.md

Lines changed: 0 additions & 105 deletions
This file was deleted.

0 commit comments

Comments
 (0)