Skip to content

Commit b424874

Browse files
authored
chore(ci): Fix pre-commit/action, as v2.x not work anymore (#878)
1 parent 521ada5 commit b424874

File tree

1 file changed

+28
-29
lines changed

1 file changed

+28
-29
lines changed

.github/workflows/pre-commit.yaml

Lines changed: 28 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -56,39 +56,38 @@ jobs:
5656
- uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
5757
with:
5858
python-version: '3.13'
59+
60+
# Needed for pre-commit fix push to succeed
61+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
62+
with:
63+
fetch-depth: 0
64+
ref: ${{ github.event.pull_request.head.ref }}
65+
# Needed to trigger pre-commit workflow on autofix commit. Guide:
66+
# https://web.archive.org/web/20210731173012/https://github.community/t/required-check-is-expected-after-automated-push/187545/
67+
ssh-key: ${{ secrets.GHA_AUTOFIX_COMMIT_KEY }}
68+
5969
- name: Execute pre-commit
60-
uses: pre-commit/action@9b88afc9cd57fd75b655d5c71bd38146d07135fe # v2.0.3
70+
uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1
6171
env:
62-
SKIP: no-commit-to-branch,hadolint
72+
SKIP: no-commit-to-branch
6373
with:
64-
token: ${{ secrets.GITHUB_TOKEN }}
6574
extra_args: >-
6675
--color=always
6776
--show-diff-on-failure
68-
--files ${{ steps.file_changes.outputs.files }}
69-
# Run only skipped checks
70-
- name: Execute pre-commit check that have no auto-fixes
71-
if: always()
72-
uses: pre-commit/action@9b88afc9cd57fd75b655d5c71bd38146d07135fe # v2.0.3
73-
env:
74-
SKIP: >-
75-
check-added-large-files,
76-
check-merge-conflict,
77-
check-vcs-permalinks,
78-
forbid-new-submodules,
79-
no-commit-to-branch,
80-
end-of-file-fixer,
81-
trailing-whitespace,
82-
check-yaml,
83-
check-merge-conflict,
84-
check-executables-have-shebangs,
85-
check-case-conflict,mixed-line-ending,
86-
detect-aws-credentials,
87-
detect-private-key,
88-
shfmt,
89-
shellcheck,
77+
--files ${{ steps.file_changes.outputs.files}}
78+
79+
# Needed to trigger pre-commit workflow on autofix commit
80+
- name: Push fixes
81+
if: failure()
82+
uses: EndBug/add-and-commit@a94899bca583c204427a224a7af87c02f9b325d5 # v9.1.4
9083
with:
91-
extra_args: >-
92-
--color=always
93-
--show-diff-on-failure
94-
--files ${{ steps.file_changes.outputs.files }}
84+
# Determines the way the action fills missing author name and email.
85+
# Three options are available:
86+
# - github_actor -> UserName <[email protected]>
87+
# - user_info -> Your Display Name <[email protected]>
88+
# - github_actions -> github-actions <email associated with the github logo>
89+
# Default: github_actor
90+
default_author: github_actor
91+
# The message for the commit.
92+
# Default: 'Commit from GitHub Actions (name of the workflow)'
93+
message: '[pre-commit] Autofix violations'

0 commit comments

Comments
 (0)