diff --git a/.github/workflows/merge-to-stage.js b/.github/workflows/merge-to-stage.js index c409476136..94d23bbfc8 100644 --- a/.github/workflows/merge-to-stage.js +++ b/.github/workflows/merge-to-stage.js @@ -30,7 +30,7 @@ const SLACK = { `:fast_forward: Created <${html_url}|Stage to Main PR ${number}>`, }; -let github, owner, repo, currPrNumber, core; +let github, owner, repo, currPrNumber, core, getOctokit; let body = ` ## common base root URLs @@ -135,7 +135,7 @@ const merge = async ({ prs }) => { } files.forEach((file) => (SEEN[file] = true)); if (!process.env.LOCAL_RUN) { - const octokit = github.getOctokit(process.env.MILO_GITHUB_TOKEN); + const octokit = getOctokit(process.env.MILO_GITHUB_TOKEN); await octokit.rest.pulls.merge({ owner, repo, @@ -225,6 +225,7 @@ const main = async (params) => { repo = params.context.repo.repo; currPrNumber = params.context.issue?.number; core = params.core; + getOctokit = params.getOctokit; const now = new Date(); // We need to revisit this every year diff --git a/.github/workflows/merge-to-stage.yaml b/.github/workflows/merge-to-stage.yaml index a9b8b18bfa..c1758ccf85 100644 --- a/.github/workflows/merge-to-stage.yaml +++ b/.github/workflows/merge-to-stage.yaml @@ -29,7 +29,8 @@ jobs: uses: actions/github-script@v7.0.1 with: script: | + const {getOctokit} = require('@actions/github') const main = require('./.github/workflows/merge-to-stage.js') - main({ github, context, core }) + main({ github, context, core, getOctokit }) env: MILO_GITHUB_TOKEN: ${{ steps.milo-pr-merge-token.outputs.token }}