Skip to content

Commit b74450b

Browse files
committed
Don't attempt to create new PRs on PRs from forks
1 parent b4949a7 commit b74450b

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Diff for: .github/workflows/version_check.yml

+6-3
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ jobs:
3030
# Determine whether the target branch is master (i.e. this is a push to
3131
# master or a PR to master).
3232
TARGET_IS_MASTER: ${{ (github.event_name == 'push' && github.ref_name == 'master') || (github.event_name == 'pull_request' && github.base_ref == 'master') }}
33+
IS_PR_FROM_FORK: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork }}
3334
# Disable precompilation as it takes a long time and is not needed for this workflow
3435
JULIA_PKG_PRECOMPILE_AUTO: 0
3536

@@ -46,14 +47,16 @@ jobs:
4647
echo github.ref_name: ${{ github.ref_name }}
4748
echo github.base_ref: ${{ github.base_ref }}
4849
echo TARGET_IS_MASTER: ${{ env.TARGET_IS_MASTER }}
50+
echo IS_PR_FROM_FORK: ${{ env.IS_PR_FROM_FORK }}
4951
5052
- name: Check version consistency
53+
id: version_check
5154
continue-on-error: true
5255
run: julia --color=yes .github/workflows/version_check.jl
5356

5457
- name: Create a PR with suggested changes
5558
id: create_pr
56-
if: env.TARGET_IS_MASTER
59+
if: steps.version_check.outcome == 'failure' && env.TARGET_IS_MASTER && (! env.IS_PR_FROM_FORK)
5760
uses: peter-evans/create-pull-request@v6
5861
with:
5962
base: ${{ github.event_name == 'pull_request' && github.head_ref || github.ref_name }}
@@ -62,8 +65,8 @@ jobs:
6265
body: "This PR is automatically generated by the `version_check.yml` GitHub Action."
6366
title: "Update Turing.jl version to match latest release"
6467

65-
- name: Comment on PR about suggested changes
66-
if: ${{ github.event_name == 'pull_request' && steps.create_pr.outputs.pull-request-operation == 'created' }}
68+
- name: Comment on PR about suggested changes (if PR was made)
69+
if: github.event_name == 'pull_request' && steps.create_pr.outputs.pull-request-operation == 'created'
6770
uses: thollander/actions-comment-pull-request@v2
6871
with:
6972
message: |

0 commit comments

Comments
 (0)