@@ -12,12 +12,15 @@ jobs:
1212 runs-on : ubuntu-latest
1313 steps :
1414 - name : Checkout
15- uses : actions/checkout@v2
15+ uses : actions/checkout@v3
16+ with :
17+ ref : ${{ github.base_ref }}
1618 - 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)
1820 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
2124 - name : Set up Python environment
2225 uses : actions/setup-python@master
2326 with :
@@ -26,13 +29,12 @@ jobs:
2629 run : |
2730 pip install pre-commit
2831 pre-commit install-hooks
29- pre-commit install --hook-type commit-msg --hook-type pre-push
3032 - name : Run pre-commit and check for any changes
3133 run : |
3234 echo "Commits being checked:"
33- git log --oneline --no-decorate base_ref..pr_ref
35+ git log --oneline --no-decorate origin/HEAD..HEAD
3436 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
3638 echo ""
3739 echo "::notice::It looks like the commits in this PR have been made without having pre-commit hooks installed."
3840 echo "::notice::Please see https://github.com/espressif/esp-protocols/CONTRIBUTING.md for instructions."
0 commit comments