Skip to content

Commit 5d558ed

Browse files
committed
do not trigger workflow automatically for forks
1 parent d25367f commit 5d558ed

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

.github/workflows/upload-dev-build.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,16 @@ env:
1818
jobs:
1919
upload:
2020
runs-on: ubuntu-latest
21+
# Only run on manual dispatch,
22+
# OR if the parent run succeeded and was triggered by a PR from
23+
# a branch in the main repo (not a fork)
2124
if: |
2225
github.event_name == 'workflow_dispatch' ||
2326
(
2427
github.event_name == 'workflow_run' &&
2528
github.event.workflow_run.event == 'pull_request' &&
26-
github.event.workflow_run.conclusion == 'success'
29+
github.event.workflow_run.conclusion == 'success' &&
30+
github.event.workflow_run.head_repository.full_name == github.repository
2731
)
2832
steps:
2933
- name: Get required metadata (PR number, commit SHA, workflow run ID containing artifacts)
@@ -49,7 +53,7 @@ jobs:
4953
exit 1
5054
fi
5155
52-
# If PR_NUM is empty (this is the case for forks) get PR number using SHA
56+
# If PR_NUM is empty, get PR number using SHA
5357
if [ -z "${PR_NUM}" ]; then
5458
PR_NUM=$(gh pr list --search "sha:${SHA}" --state open --json number --jq '.[0].number')
5559
fi

0 commit comments

Comments
 (0)