From 5b866ca8f6274074f8ab8d771ea028ed3323efb9 Mon Sep 17 00:00:00 2001 From: Penelope Yong Date: Thu, 22 Aug 2024 22:46:42 +0100 Subject: [PATCH] Don't attempt to create new PRs on PRs from forks --- .github/workflows/version_check.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/version_check.yml b/.github/workflows/version_check.yml index fae0bff61..6c859e7e6 100644 --- a/.github/workflows/version_check.yml +++ b/.github/workflows/version_check.yml @@ -30,6 +30,7 @@ jobs: # Determine whether the target branch is master (i.e. this is a push to # master or a PR to master). TARGET_IS_MASTER: ${{ (github.event_name == 'push' && github.ref_name == 'master') || (github.event_name == 'pull_request' && github.base_ref == 'master') }} + IS_PR_FROM_FORK: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork }} # Disable precompilation as it takes a long time and is not needed for this workflow JULIA_PKG_PRECOMPILE_AUTO: 0 @@ -46,14 +47,16 @@ jobs: echo github.ref_name: ${{ github.ref_name }} echo github.base_ref: ${{ github.base_ref }} echo TARGET_IS_MASTER: ${{ env.TARGET_IS_MASTER }} + echo IS_PR_FROM_FORK: ${{ env.IS_PR_FROM_FORK }} - name: Check version consistency + id: version_check continue-on-error: true run: julia --color=yes .github/workflows/version_check.jl - name: Create a PR with suggested changes id: create_pr - if: env.TARGET_IS_MASTER + if: env.TARGET_IS_MASTER && ! env.IS_PR_FROM_FORK uses: peter-evans/create-pull-request@v6 with: base: ${{ github.event_name == 'pull_request' && github.head_ref || github.ref_name }} @@ -62,7 +65,7 @@ jobs: body: "This PR is automatically generated by the `version_check.yml` GitHub Action." title: "Update Turing.jl version to match latest release" - - name: Comment on PR about suggested changes + - name: Comment on PR about suggested changes (if PR was made) if: ${{ github.event_name == 'pull_request' && steps.create_pr.outputs.pull-request-operation == 'created' }} uses: thollander/actions-comment-pull-request@v2 with: