Skip to content

Commit 14f2ae5

Browse files
authored
chore: fix bot script to address github-script V5 changes (#4537)
1 parent b660726 commit 14f2ae5

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

.github/actions/bot/src/run.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@
1919
async function run(core, context, github) {
2020

2121
try {
22-
const owner = process.env.PROVIDER;
23-
const repo = process.env.REPOSITORY;
22+
const owner = context.repo.owner;
23+
const repo = context.repo.repo;
2424
const reRunCmd = process.env.RERUN_CMD;
2525
const comment = context.payload.comment.body;
2626

2727
if (comment !== reRunCmd) {
28-
console.log("this is not a bot command");
28+
core.info("this is not a bot command");
2929
return;
3030
}
3131

@@ -35,13 +35,13 @@ async function run(core, context, github) {
3535
sha: prRef,
3636
}
3737
}
38-
} = await github.pulls.get({
38+
} = await github.rest.pulls.get({
3939
owner,
4040
repo,
4141
pull_number: context.issue.number,
4242
});
4343

44-
const jobs = await github.checks.listForRef({
44+
const jobs = await github.rest.checks.listForRef({
4545
owner,
4646
repo,
4747
ref: prRef,
@@ -50,8 +50,8 @@ async function run(core, context, github) {
5050

5151
jobs.data.check_runs.forEach(job => {
5252
if (job.conclusion === 'failure' || job.conclusion === 'cancelled') {
53-
console.log("rerun job " + job.name);
54-
github.checks.rerequestSuite({
53+
core.info("rerun job " + job.name);
54+
github.rest.checks.rerequestSuite({
5555
owner,
5656
repo,
5757
check_suite_id: job.check_suite.id

.github/workflows/bot.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,10 @@ jobs:
3434
- name: bot actions
3535
uses: actions/github-script@v7
3636
env:
37-
PROVIDER: 'apache'
38-
REPOSITORY: 'bookkeeper'
3937
RERUN_CMD: 'rerun failure checks'
4038
with:
4139
github-token: ${{secrets.BKBOT_TOKEN}}
4240
script: |
4341
const path = require('path')
4442
const scriptPath = path.resolve('.github/actions/bot/src/run.js')
45-
require(scriptPath)({core}, {context}, {github})
43+
require(scriptPath)({core}, {context}, {github})

0 commit comments

Comments
 (0)