Skip to content

Commit 3bb79bf

Browse files
chore(ci): skip auto commit if scoped token is not present (#635)
1 parent 6647e02 commit 3bb79bf

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

.github/workflows/pre-commit.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ jobs:
1212
pre-commit:
1313
runs-on: ubuntu-latest
1414
timeout-minutes: 10
15+
env:
16+
REPO_SCOPED_TOKEN: ${{ secrets.REPO_SCOPED_TOKEN }}
1517

1618
steps:
1719
- name: Check out the repo
1820
uses: actions/checkout@v4
1921
with:
2022
fetch-depth: 0
21-
repository: ${{ github.event.pull_request.head.repo.full_name }}
22-
ref: ${{ github.event.pull_request.head.ref }}
23-
token: ${{ secrets.REPO_SCOPED_TOKEN || github.token }}
23+
token: ${{ env.REPO_SCOPED_TOKEN || github.token }}
2424

2525
- name: Setup environment
2626
uses: ./.github/actions/setup-environment
@@ -38,8 +38,7 @@ jobs:
3838
shell: bash
3939

4040
- uses: stefanzweifel/git-auto-commit-action@v5
41-
# Always commit changes even if pre-commit failed
42-
if: always() && github.event_name == 'pull_request'
41+
if: ${{ always() && env.REPO_SCOPED_TOKEN && github.event_name == 'pull_request' }}
4342
with:
4443
commit_message: "Automated pre-commit update"
4544
push_options: "--no-verify"

0 commit comments

Comments
 (0)