ci: Fix PR reporter for non-main branch targets #4900
Merged
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.
Re: #4891 (comment).
My guinea pig is still testing this, but seems like it'll work.My guinea pig has confirmed it'll work.TLDR: PR events, when coming from those who have maintainer rights, include a field called
pull_requeststhat looks like this:Forked repo, on the other hand, gets this:
"pull_requests": []...which is lame & there are no other references to the base SHA anywhere else in the event payload. Alternatively, one would think they could use GitHub's API to query for PRs containing a commit, or just query the commit & get the PRs that include it, but these too don't work for unknown reasons when the commit comes from a fork.
Instead, we're using the owner+branch name, querying for all PRs on the repo that match, getting the latest result & extracting the base SHA from it. This is weird but GitHub's data doesn't give us a choice.