Skip to content

Commit

Permalink
Merge pull request #124 from adhoc-dev/18.0-pre-commit-test
Browse files Browse the repository at this point in the history
[IMP] run only on pull_request_target
  • Loading branch information
az-adhoc authored Feb 27, 2025
2 parents 4a547a0 + a1345f4 commit 7a7c952
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,16 @@ jobs:
uses: pre-commit/action@v3.0.1
continue-on-error: true
-
name: Create status on success only
env:
PRECOMMIT_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PRECOMMIT_STATE: ${{ steps.precommit.outcome }}
name: Create status
if: github.event_name == 'pull_request_target'
run: |
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $PRECOMMIT_TOKEN" \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/${{ github.repository }}/statuses/${{ github.event.pull_request.head.sha }} \
-d '{"state":"$PRECOMMIT_STATE","context":"pre-commit","target_url": "${{ github.event.pull_request.html_url }}"}' \
-d '{"state":"${{ steps.precommit.outcome }}","context":"pre-commit","target_url": "${{ github.event.pull_request.html_url }}"}' \
--fail
-
name: Set output if pre-commit failed
Expand Down

0 comments on commit 7a7c952

Please sign in to comment.