This is an automated email from the ASF dual-hosted git repository.

shoothzj pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/bookkeeper.git


The following commit(s) were added to refs/heads/master by this push:
     new 14f2ae5586 chore: fix bot script to address github-script V5 changes 
(#4537)
14f2ae5586 is described below

commit 14f2ae55865b34bfa827334c2db67967ec8882b8
Author: Yuri Mizushima <[email protected]>
AuthorDate: Mon Dec 30 15:12:28 2024 +0900

    chore: fix bot script to address github-script V5 changes (#4537)
---
 .github/actions/bot/src/run.js | 14 +++++++-------
 .github/workflows/bot.yml      |  4 +---
 2 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/.github/actions/bot/src/run.js b/.github/actions/bot/src/run.js
index 01524919a6..c4e792cbf0 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 43d61c1179..916b53b13b 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})

Reply via email to