-
Notifications
You must be signed in to change notification settings - Fork 255
Fix Cloning in CI for Forks #249
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
Merged
Merged
Changes from 22 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
aa7f316
test
dey4ss e09467e
test
dey4ss 611ff58
test
dey4ss 0c2f80f
test
dey4ss 4786deb
test
dey4ss 7965f4c
test
dey4ss 542e70b
test
dey4ss 59387e2
test
dey4ss ac3103d
test
dey4ss 34377bc
test
dey4ss 27bc2d9
test
dey4ss f169773
test
dey4ss 538c604
test
dey4ss 82f32d8
test
dey4ss 0de6b53
test
dey4ss b7e6b5b
test
dey4ss bdc0342
test
dey4ss 767c183
test
dey4ss cf66f10
test
dey4ss 6622ef1
test
dey4ss 3e25203
test
dey4ss 299d7a1
test
dey4ss fb7c373
version that works for branch update
dey4ss ef301fc
add some documentation
dey4ss File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please add a comment?
Looking at the line, maybe 30-40 lines? Just to understand what is happening here.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it's really not nice and I don't really like it either.
The problem is that the repository referenced by the environment variables and contexts Github provides are always the one where the PR/push happens. In the case of forks, that's still our repo and not the forked one that gets cloned. Then, the branch providing the changes cannot be found there.
github.event.pull_request.head.repo.clone_urlis the URL of the repo referenced by the HEAD if the event that triggers the action is a PR. That's unset/empty if the event is not a PR, but a push to master (or another branch where we want to run the action). Thus, we check if we have that and if not, we simply clone from the "regular" repo Github gives us. I tried that with PRs from a fork and within our repo (where it worked), but I also want to test it with pushing to a branch in our repo.I have no idea how to tell this in a nice way, but I guess it should also feature some links with information about these contexts, i.e., https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/store-information-in-variables#default-environment-variables and https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/accessing-contextual-information-about-workflow-runs#github-context.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should now work for both scenarios: https://github.com/hyrise/sql-parser/actions/workflows/ci.yml
The first line is a PR within the base repository, the second one is a PR from a fork, and the third line is a push to a branch within the base repo (which was added to the branches where updates trigger action runs for this test).