-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Skip earlier when run on forks #11212
Skip earlier when run on forks #11212
Conversation
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.
Reviewing this PR in order to trigger a pull_request_review
event to trigger the job... let's see what happens!
0462149
to
2668296
Compare
Once this is merged, I'll need to double-check that when run against a fork via |
I found the original code confusing because it _always_ checks if the PR is approved, even when run on forks. Yet the job still bails if run on a fork, _even if the PR is approved_. So I pulled the `if` conditional that bypasses forks up into the first job. If that results in skipping the `approval` job, then the subsequent job that `needs: approval` will also be skipped ([docs](https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#jobsjob_idneeds)). So this should hopefully be both more readable within the code, more readable on PR's, and also more performant. 🥂 Originally, I wasn't 100% sure this would work... perhaps there was a reason why the fork-check conditional needed to be attached to the second job. However, when I checked `git blame` I see that originally this was a single job, and then split in two: * dependabot#8651 And looking at the commit history on that PR, I think these two commits indicate the author was focused on simplifying two steps into one, so didn't consider the possibility of skipping earlier: * dependabot@ede644b * dependabot@c7069e6
2668296
to
201c600
Compare
I discussed this with @landongrindheim and @pavera and this change seemed sensible to them as well, so 🚢 |
What are you trying to accomplish?
I found the original code confusing because it always checks if the PR is approved, even when run on forks. Yet the job still bails if run on a fork, even if the PR is approved.
So I pulled the
if
conditional that bypasses forks up into the first job. This works because if theapproval
job gets skipped, then the subsequent job will also be skipped since itneeds: approval
(docs).So this should hopefully be both more readable within the code, more readable in CI output on PR's, and also more performant. 🥂
Anything you want to highlight for special attention from reviewers?
Originally, I wasn't 100% sure this works... perhaps there was a reason why the fork-check conditional needed to be attached to the second job.
However, when I checked
git blame
I see that originally this was a single job, and then split in two:And looking at the commit history on that PR, I think these two commits indicate the author was focused on simplifying two steps into one, so didn't consider the possibility of skipping earlier:
In order to test this, I've opened this PR from my personal fork, rather than the main Dependabot repo...