ci: run the empty-diff gate only on pull requests - #113
Merged
Conversation
The reusable reads the pull request base ref and fails closed when it is missing. That is right inside a pull request and wrong on a push: this workflow also runs on push to main, where there is no pull request in the payload, so every push to main has failed since the caller landed. Guarding the job on the event skips it on push instead of failing. A skipped job does not fail the run, and it does not weaken the gate for required-check purposes either, because a required check only gates the merge of a pull request, where the job still runs. Signed-off-by: Jaro-c <75870284+Jaro-c@users.noreply.github.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The empty-diff reusable reads the pull request base ref and is fail-closed when it is missing, which is right inside a pull request. This workflow also runs on push to main, where there is no pull request payload, so every push to main now fails with "could not determine the pull request base ref".
I am guarding the job with
if: github.event_name == 'pull_request'so it is skipped on push instead of failing. A skipped job does not fail the run, and it does not weaken the gate for required-check purposes either, because a required check only gates the merge of a pull request, where the job still runs.The .github repo has issues disabled, so this PR carries the problem statement in its body.