diff --git a/.github/workflows/version_check.yml b/.github/workflows/version_check.yml index fae0bff61..a8842d705 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: steps.version_check.outcome == 'failure' && 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,8 +65,8 @@ 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 - if: ${{ github.event_name == 'pull_request' && steps.create_pr.outputs.pull-request-operation == 'created' }} + - 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: message: |