Skip to content

Commit

Permalink
Don't attempt to create new PRs on PRs from forks (TuringLang#511)
Browse files Browse the repository at this point in the history
  • Loading branch information
penelopeysm authored Aug 23, 2024
1 parent b4949a7 commit 3812204
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/version_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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 }}
Expand All @@ -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: |
Expand Down

0 comments on commit 3812204

Please sign in to comment.