@@ -12,12 +12,15 @@ jobs:
12
12
runs-on : ubuntu-latest
13
13
steps :
14
14
- name : Checkout
15
- uses : actions/checkout@v2
15
+ uses : actions/checkout@v3
16
+ with :
17
+ ref : ${{ github.base_ref }}
16
18
- name : Fetch head and base refs
17
- # This is necessary for pre-commit to check the changes in the PR branch
19
+ # This is necessary for pre-commit to check the changes in the PR branch (and to set origin/HEAD and HEAD refs)
18
20
run : |
19
- git fetch origin ${{ github.base_ref }}:base_ref
20
- git fetch origin pull/${{ github.event.pull_request.number }}/head:pr_ref
21
+ git fetch origin ${{ github.event.pull_request.head.sha }}:pr_ref
22
+ git checkout pr_ref
23
+ git remote set-head origin --auto
21
24
- name : Set up Python environment
22
25
uses : actions/setup-python@master
23
26
with :
@@ -26,13 +29,12 @@ jobs:
26
29
run : |
27
30
pip install pre-commit
28
31
pre-commit install-hooks
29
- pre-commit install --hook-type commit-msg --hook-type pre-push
30
32
- name : Run pre-commit and check for any changes
31
33
run : |
32
34
echo "Commits being checked:"
33
- git log --oneline --no-decorate base_ref..pr_ref
35
+ git log --oneline --no-decorate origin/HEAD..HEAD
34
36
echo ""
35
- if ! pre-commit run --from-ref base_ref --to-ref pr_ref --show-diff-on-failure ; then
37
+ if ! pre-commit run --from-ref origin/HEAD --to-ref HEAD --hook-stage manual --show-diff-on-failure ; then
36
38
echo ""
37
39
echo "::notice::It looks like the commits in this PR have been made without having pre-commit hooks installed."
38
40
echo "::notice::Please see https://github.com/espressif/esp-protocols/CONTRIBUTING.md for instructions."
0 commit comments