77 - synchronize
88
99env :
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
1213jobs :
1314 pre-commit :
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
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 }}
@@ -46,16 +47,12 @@ jobs:
4647 cache-dependency-glob : |
4748 pyproject.toml
4849 uv.lock
49- - name : Install Dependencies
50- run : |
51- uv venv
52- uv sync
5350 - name : Run prek - pre-commit
5451 id : precommit
5552 run : uvx prek run --from-ref origin/${GITHUB_BASE_REF} --to-ref HEAD --show-diff-on-failure
5653 continue-on-error : true
5754 - name : Commit and push changes
58- if : env.IS_FORK == 'false '
55+ if : env.HAS_SECRETS == 'true '
5956 run : |
6057 git config user.name "github-actions[bot]"
6158 git config user.email "github-actions[bot]@users.noreply.github.com"
6764 git push
6865 fi
6966 - uses : pre-commit-ci/lite-action@v1.1.0
70- if : env.IS_FORK == 'true '
67+ if : env.HAS_SECRETS == 'false '
7168 with :
7269 msg : 🎨 Auto format
7370 - name : Error out on pre-commit errors
8885 - name : Decide whether the needed jobs succeeded or failed
8986 uses : re-actors/alls-green@release/v1
9087 with :
91- jobs : ${{ toJSON(needs) }}
88+ jobs : ${{ toJSON(needs) }}
0 commit comments