diff --git a/.github/actions/bot/src/run.js b/.github/actions/bot/src/run.js index 01524919a66..c4e792cbf0d 100644 --- a/.github/actions/bot/src/run.js +++ b/.github/actions/bot/src/run.js @@ -19,13 +19,13 @@ async function run(core, context, github) { try { - const owner = process.env.PROVIDER; - const repo = process.env.REPOSITORY; + const owner = context.repo.owner; + const repo = context.repo.repo; const reRunCmd = process.env.RERUN_CMD; const comment = context.payload.comment.body; if (comment !== reRunCmd) { - console.log("this is not a bot command"); + core.info("this is not a bot command"); return; } @@ -35,13 +35,13 @@ async function run(core, context, github) { sha: prRef, } } - } = await github.pulls.get({ + } = await github.rest.pulls.get({ owner, repo, pull_number: context.issue.number, }); - const jobs = await github.checks.listForRef({ + const jobs = await github.rest.checks.listForRef({ owner, repo, ref: prRef, @@ -50,8 +50,8 @@ async function run(core, context, github) { jobs.data.check_runs.forEach(job => { if (job.conclusion === 'failure' || job.conclusion === 'cancelled') { - console.log("rerun job " + job.name); - github.checks.rerequestSuite({ + core.info("rerun job " + job.name); + github.rest.checks.rerequestSuite({ owner, repo, check_suite_id: job.check_suite.id diff --git a/.github/workflows/bot.yml b/.github/workflows/bot.yml index 43d61c1179a..916b53b13b3 100644 --- a/.github/workflows/bot.yml +++ b/.github/workflows/bot.yml @@ -34,12 +34,10 @@ jobs: - name: bot actions uses: actions/github-script@v7 env: - PROVIDER: 'apache' - REPOSITORY: 'bookkeeper' RERUN_CMD: 'rerun failure checks' with: github-token: ${{secrets.BKBOT_TOKEN}} script: | const path = require('path') const scriptPath = path.resolve('.github/actions/bot/src/run.js') - require(scriptPath)({core}, {context}, {github}) \ No newline at end of file + require(scriptPath)({core}, {context}, {github})