Skip to content

Commit d617814

Browse files
authored
ci: fix target branch name usage (#938)
1 parent 4a637e6 commit d617814

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

.github/workflows/test.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,21 @@ jobs:
4444
name: Run pre-commit
4545
if: github.event.action != 'closed' && github.event.pull_request.merged != true
4646
run: |
47-
pre-commit run --from-ref ${{ github.event.pull_request.base.sha }} --to-ref ${{ github.event.pull_request.head.sha }} --show-diff-on-failure --color=always
47+
pre-commit run --from-ref "${FROM_REF}" --to-ref "${TO_REF}" --show-diff-on-failure --color=always
48+
env:
49+
FROM_REF: ${{ github.event.pull_request.base.sha }}
50+
TO_REF: ${{ github.event.pull_request.head.sha }}
4851
- name: Commit changes
4952
if: ${{ failure() }}
5053
run: |-
5154
git add -A
5255
git config user.name "${GIT_AUTHOR_NAME}"
5356
git config user.email "${GIT_AUTHOR_EMAIL}"
5457
git commit -m "pre-commit fixes"
55-
git push origin HEAD:${{ github.event.pull_request.head.ref }}
58+
git push origin "HEAD:${HEAD_REF}"
5659
exit 1
60+
env:
61+
HEAD_REF: ${{ github.event.pull_request.head.ref }}
5762

5863
test:
5964
strategy:

0 commit comments

Comments
 (0)