committed by
GitHub
1 changed files with 6 additions and 5 deletions
@ -7,7 +7,8 @@ on: |
|||||
- synchronize |
- synchronize |
||||
|
|
||||
env: |
env: |
||||
IS_FORK: ${{ github.event.pull_request.head.repo.full_name != github.repository }} |
# Forks and Dependabot don't have access to secrets |
||||
|
HAS_SECRETS: ${{ secrets.PRE_COMMIT != '' }} |
||||
|
|
||||
jobs: |
jobs: |
||||
pre-commit: |
pre-commit: |
||||
@ -19,7 +20,7 @@ jobs: |
|||||
run: echo "$GITHUB_CONTEXT" |
run: echo "$GITHUB_CONTEXT" |
||||
- uses: actions/checkout@v5 |
- uses: actions/checkout@v5 |
||||
name: Checkout PR for own repo |
name: Checkout PR for own repo |
||||
if: env.IS_FORK == 'false' |
if: env.HAS_SECRETS == 'true' |
||||
with: |
with: |
||||
# To be able to commit it needs to fetch the head of the branch, not the |
# To be able to commit it needs to fetch the head of the branch, not the |
||||
# merge commit |
# merge commit |
||||
@ -31,7 +32,7 @@ jobs: |
|||||
# pre-commit lite ci needs the default checkout configs to work |
# pre-commit lite ci needs the default checkout configs to work |
||||
- uses: actions/checkout@v5 |
- uses: actions/checkout@v5 |
||||
name: Checkout PR for fork |
name: Checkout PR for fork |
||||
if: env.IS_FORK == 'true' |
if: env.HAS_SECRETS == 'false' |
||||
with: |
with: |
||||
# To be able to commit it needs the head branch of the PR, the remote one |
# To be able to commit it needs the head branch of the PR, the remote one |
||||
ref: ${{ github.event.pull_request.head.sha }} |
ref: ${{ github.event.pull_request.head.sha }} |
||||
@ -56,7 +57,7 @@ jobs: |
|||||
run: uvx prek run --from-ref origin/${GITHUB_BASE_REF} --to-ref HEAD --show-diff-on-failure |
run: uvx prek run --from-ref origin/${GITHUB_BASE_REF} --to-ref HEAD --show-diff-on-failure |
||||
continue-on-error: true |
continue-on-error: true |
||||
- name: Commit and push changes |
- name: Commit and push changes |
||||
if: env.IS_FORK == 'false' |
if: env.HAS_SECRETS == 'true' |
||||
run: | |
run: | |
||||
git config user.name "github-actions[bot]" |
git config user.name "github-actions[bot]" |
||||
git config user.email "github-actions[bot]@users.noreply.github.com" |
git config user.email "github-actions[bot]@users.noreply.github.com" |
||||
@ -68,7 +69,7 @@ jobs: |
|||||
git push |
git push |
||||
fi |
fi |
||||
- uses: pre-commit-ci/[email protected] |
- uses: pre-commit-ci/[email protected] |
||||
if: env.IS_FORK == 'true' |
if: env.HAS_SECRETS == 'false' |
||||
with: |
with: |
||||
msg: 🎨 Auto format |
msg: 🎨 Auto format |
||||
- name: Error out on pre-commit errors |
- name: Error out on pre-commit errors |
||||
|
|||||
Loading…
Reference in new issue