Skip to content

Commit 83e6b7b

Browse files
committed
Apply changes like in fastapi/fastapi#14592
1 parent d8fa4fb commit 83e6b7b

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

.github/workflows/pre-commit.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ on:
77
- synchronize
88

99
env:
10-
IS_FORK: ${{ github.event.pull_request.head.repo.full_name != github.repository }}
10+
# Forks and Dependabot don't have access to secrets
11+
HAS_SECRETS: ${{ secrets.PRE_COMMIT != '' }}
1112

1213
jobs:
1314
pre-commit:
@@ -19,7 +20,7 @@ jobs:
1920
run: echo "$GITHUB_CONTEXT"
2021
- uses: actions/checkout@v5
2122
name: Checkout PR for own repo
22-
if: env.IS_FORK == 'false'
23+
if: env.HAS_SECRETS == 'true'
2324
with:
2425
# To be able to commit it needs to fetch the head of the branch, not the
2526
# merge commit
@@ -31,7 +32,7 @@ jobs:
3132
# pre-commit lite ci needs the default checkout configs to work
3233
- uses: actions/checkout@v5
3334
name: Checkout PR for fork
34-
if: env.IS_FORK == 'true'
35+
if: env.HAS_SECRETS == 'false'
3536
with:
3637
# To be able to commit it needs the head branch of the PR, the remote one
3738
ref: ${{ github.event.pull_request.head.sha }}
@@ -54,7 +55,7 @@ jobs:
5455
run: uvx prek run --from-ref origin/${GITHUB_BASE_REF} --to-ref HEAD --show-diff-on-failure
5556
continue-on-error: true
5657
- name: Commit and push changes
57-
if: env.IS_FORK == 'false'
58+
if: env.HAS_SECRETS == 'true'
5859
run: |
5960
git config user.name "github-actions[bot]"
6061
git config user.email "github-actions[bot]@users.noreply.github.com"
@@ -66,7 +67,7 @@ jobs:
6667
git push
6768
fi
6869
- uses: pre-commit-ci/lite-action@v1.1.0
69-
if: env.IS_FORK == 'true'
70+
if: env.HAS_SECRETS == 'false'
7071
with:
7172
msg: 🎨 Auto format
7273
- name: Error out on pre-commit errors

0 commit comments

Comments
 (0)