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

Update GitHub Action CI for Forks #220

Merged
merged 1 commit into from
Nov 15, 2023
Merged

Update GitHub Action CI for Forks #220

merged 1 commit into from
Nov 15, 2023

Conversation

jaxdesmarais
Copy link
Collaborator

Reason for changes

CI should run as expected on forks!

Summary of changes

  • We made this change a while ago on BT and never got around to adding it here but now that we have some outside contributors we should ensure that all PRs (even forks) work as expected

Checklist

  • [ ] Added a changelog entry

Authors

@jaxdesmarais jaxdesmarais requested a review from a team as a code owner November 14, 2023 21:58
Copy link
Collaborator

@scannillo scannillo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👏 Thank you!

@@ -10,6 +10,9 @@ jobs:
steps:
- name: Check out repository
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey Jax, thanks for doing this! Can you tell me how this allows CI to run as expected on forks? Just high level explanation would be fine!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ref Line

github.event references where we want to run CI (context docs) in our case we want to run CI on the pull_request. For PRs we want to run CI on the pull request's head branch name head.ref vs the base branch name (PR workflow events docs). So this line github.event.pull_request.head.ref is essentially saying: run CI on the branch the PR was opened from.

Repository Line

github.event.pull_request.head is the same as above so it's saying for the repository use the PRs head vs main. Then repo.full_name pulls the full path of the repo the fork is on vs attempting to pull the branch name from our path where it wouldn't exist (reference docs here).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you Jax!

@jaxdesmarais jaxdesmarais merged commit 7c561bf into main Nov 15, 2023
4 checks passed
@jaxdesmarais jaxdesmarais deleted the update-ci-for-forks branch November 15, 2023 17:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants