Re-implement get-current-pr action, add authentication.#33
Conversation
d4b584f to
7e76110
Compare
7e76110 to
0248e4a
Compare
| fi | ||
| done | ||
|
|
||
| echo "number=$(jq --raw-output '.[0].number' <<< "${response}")" >> ${GITHUB_ENV} |
There was a problem hiding this comment.
- some comments will be helpful as to why we have to check for both events?
- do both events always trigger and in which order?
- Is
${GITHUB_SHA}available in both cases? wondering if the code can be combined?
There was a problem hiding this comment.
- some comments will be helpful as to why we have to check for both events?
- do both events always trigger and in which order?
They are exclusive, we watch for any of them:
https://github.com/hazelcast/hazelcast-mono/blob/a6f00489d8e3f6170656612f2d9e5408ff33726d/.github/workflows/backport.yml#L2-L8
- Is
${GITHUB_SHA}available in both cases?
Yes, it's always part of the GitHub context.
wondering if the code can be combined?
I don't think so, or at least not in a way that makes it any better.
| # Immediately after a commit, sometimes the API returns no results, so poll for valid values | ||
| while : | ||
| do | ||
| response=$(gh api \ |
There was a problem hiding this comment.
could use https://cli.github.com/manual/gh_pr_list?
there is also ability to search
Not sure if any these is better or whether it can avoid the loop
There was a problem hiding this comment.
could use https://cli.github.com/manual/gh_pr_list? there is also ability to search
Not sure if any these is better or whether it can avoid the loop
I'd imagine under-the-hood it uses the same API.
The loop is working around an issue on the GitHub side, I guess I could raise a ticket but that doesn't help us now.
There was a problem hiding this comment.
can you add link to the issue pls?
perhaps something to revisit in the future.
There was a problem hiding this comment.
can you add link to the issue pls? perhaps something to revisit in the future.
…of `backport` action Raised after [PR feedback](hazelcast#33 (comment)) in consultation with GitHub support who provided further clarification.
Despite extensive testing for #31, the action fails with a cryptic
Not Foundwhen executed for real.After further investigation, this could be reproduced within a PR from a fork only, which was not previously tested.
The root cause is that the "implicit" token supplied to the workflow does not have permissions to query metadata outside of the repo it's being run from. Instead, we should use the supplied token that we already use for the "main" backporting operation.
After discussion as part of #32, it was also suggested to avoid using the token with a third-party action when a first-party solution was available (with some mangling).
Changes:
get-current-prstep8BitJonny/gh-get-current-prwith our own implementationSuccessful execution from a forked PR, and resultant backport.
Closes: #32