Construct orgClient inside github-script to fix module resolution
@actions/github is only resolvable from inside the github-script bundle, not from main.js. Build the PAT-authed Octokit client in action.yml and pass it into main as orgClient. Switch the team-membership check to use orgClient.rest.teams.getMembershipForUserInOrg instead of a raw request with header override.
This commit is contained in:
parent
924ee55f9b
commit
5d105acf64
1 changed files with 16 additions and 13 deletions
|
|
@ -99,5 +99,11 @@ 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 });
|
||||
await main({ github, context, core, orgClient });
|
||||
|
|
|
|||
Loading…
Reference in a new issue