Skip to content

Update token supplied to 8BitJonny/gh-get-current-pr to support forked-PR execution#32

Closed
JackPGreen wants to merge 2 commits intohazelcast:masterfrom
JackPGreen:fix-token
Closed

Update token supplied to 8BitJonny/gh-get-current-pr to support forked-PR execution#32
JackPGreen wants to merge 2 commits intohazelcast:masterfrom
JackPGreen:fix-token

Conversation

@JackPGreen
Copy link
Copy Markdown
Contributor

Despite extensive testing for #31, the action fails with a cryptic Not Found when 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.

Successful execution from a forked PR, and resultant backport.

Clarify comment regarding GitHub token usage in workflow.
@JackPGreen JackPGreen self-assigned this Dec 8, 2025
@nishaatr
Copy link
Copy Markdown

nishaatr commented Dec 9, 2025

I see token is passed here https://github.com/hazelcast/hazelcast-mono/blob/master/.github/workflows/backport.yml
Some questions:

  1. this means DEVOPSHAZELCAST_PAT_FOR_MONOREPO will have access to any fork and not only yours (may be you have permissioned it)?
  2. the token is being passed to 8BitJonny/gh-get-current-pr. Is this ok or any chance token can be exposed?
  3. we should test it this tested beyond yourself (after merge)
  4. of out interest, is the backport PR created in the target or the fork?

JackPGreen added a commit that referenced this pull request Dec 11, 2025
Despite _extensive_ testing for
#31, [the action fails with a
cryptic `Not Found` when executed for
real](https://github.com/hazelcast/hazelcast-mono/actions/runs/20035261330).

After further investigation, this could be reproduced [within a PR from
a fork
_only_](https://github.com/JackPGreen/backport-test/actions/runs/20035612426/job/57456162344),
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_](https://github.com/orgs/community/discussions/46566).
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:
- add token to `get-current-pr` step
- replace `8BitJonny/gh-get-current-pr` with our own implementation
- fix a syntax error when creating backport branches

[Successful execution from a forked
PR](https://github.com/JackPGreen/backport-test/actions/runs/20098427088),
and [resultant
backport](JackPGreen/backport-test#242).

Closes: #32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants