Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify version_check.yml to not create new PRs on PRs from forks #511

Merged
merged 1 commit into from
Aug 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading