Skip to content

Commit

Permalink
[IMP] run only on pull_request_target
Browse files Browse the repository at this point in the history
  • Loading branch information
az-adhoc committed Feb 27, 2025
1 parent 648122b commit a1345f4
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 a1345f4

Please sign in to comment.