Use raw fetch for team membership check — bypass Octokit auth entirely
The previous attempt (constructing orgClient via require('@actions/github')
inside the inline script) fails with MODULE_NOT_FOUND — the package is
bundled into github-script's dist/index.js and not resolvable even from
the eval'd inline script.
Switch to a raw fetch() call for the team membership endpoint. Node 20
(github-script@v8) has global fetch, so this has zero dependencies and
is immune to Octokit's auth-hook override behavior.
This commit is contained in:
parent
bd238ed6e4
commit
5cfe4d9921
1 changed files with 37 additions and 32 deletions
|
|
@ -99,11 +99,5 @@ runs:
|
|||
with:
|
||||
github-token: ${{ inputs.bot-token }}
|
||||
script: |
|
||||
// Construct a second Octokit client authed with the PAT for
|
||||
// org team-membership checks. This has to happen here, not in
|
||||
// main.js, because @actions/github is only resolvable from
|
||||
// inside the github-script bundle.
|
||||
const { getOctokit } = require('@actions/github');
|
||||
const orgClient = getOctokit(process.env.ORG_TOKEN);
|
||||
const main = require(process.env.GITHUB_ACTION_PATH + '/main.js');
|
||||
await main({ github, context, core, orgClient });
|
||||
await main({ github, context, core });
|
||||
|
|
|
|||
Loading…
Reference in a new issue