Skip to content

Commit

Permalink
fix: add guard to PR status so workflows can be reused outside PRs
Browse files Browse the repository at this point in the history
  • Loading branch information
dnlopes committed Sep 14, 2024
1 parent a238c85 commit 9cef279
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/python.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ jobs:
uses: actions/checkout@v4

- name: Set status pending
if: github.event_name == 'pull_request' || github.event_name == 'pull_request_target'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
Expand Down Expand Up @@ -86,7 +87,7 @@ jobs:
CODECOV_TOKEN: "${{ secrets.CODECOV_TOKEN }}"

- name: Set status success
if: ${{ success() || inputs.IgnoreErrors == true }}
if: ${{ (success() || inputs.IgnoreErrors == true) && (github.event_name == 'pull_request' || github.event_name == 'pull_request_target') }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
Expand All @@ -96,7 +97,7 @@ jobs:
-f "context=${{ env.CHECK_NAME }}"
- name: Set status failure
if: ${{ failure() && inputs.IgnoreErrors == false }}
if: ${{ (failure() && inputs.IgnoreErrors == false) && (github.event_name == 'pull_request' || github.event_name == 'pull_request_target') }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
Expand Down

0 comments on commit 9cef279

Please sign in to comment.