File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -58,14 +58,21 @@ jobs:
58
58
with :
59
59
path : ~/.cache/pre-commit
60
60
key : pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }}
61
+ - name : Determine pre-commit range
62
+ id : commit_range
63
+ run : |
64
+ FROM_REF=$(git merge-base HEAD origin/master)
65
+ echo "from_ref=$FROM_REF" >> $GITHUB_OUTPUT
66
+ echo "to_ref=HEAD" >> $GITHUB_OUTPUT
67
+ echo "Pre-commit will check from $FROM_REF to HEAD"
61
68
- id : pre_commit
62
69
name : Run pre-commit
63
70
if : github.event.action != 'closed' && github.event.pull_request.merged != true
64
71
run : |
65
72
pre-commit run --from-ref "${FROM_REF}" --to-ref "${TO_REF}" --show-diff-on-failure --color=always
66
73
env :
67
- FROM_REF : ${{ github.event.pull_request.base.sha }}
68
- TO_REF : ${{ github.event.pull_request.head.sha }}
74
+ FROM_REF : ${{ steps.commit_range.outputs.from_ref }}
75
+ TO_REF : ${{ steps.commit_range.outputs.to_ref }}
69
76
- name : Commit changes
70
77
if : failure() && inputs.enable-commit-changes && github.event.pull_request.head.repo.full_name == github.repository
71
78
run : |-
You can’t perform that action at this time.
0 commit comments