From 3af67d8c81f62e15639f3bdf3c55283403cdff55 Mon Sep 17 00:00:00 2001 From: Wei-Ting Chen Date: Tue, 20 Aug 2024 23:25:23 +0800 Subject: [PATCH] [VL][1.2] Port 6911 6919 for github workflow resource not accessible issue fix (#6945) * [GLUTEN-6915][MISC]Fix workflow permission issue. (#6911) * [GLUTEN-6915][CORE]Fix listComments TypeError (#6919) * Fix listComments TypeError * Fix listComments in title_check.js * fix typo. * Update github rest * add per_page * fix * enable debug * remove debug --- .github/workflows/dev_cron.yml | 7 ++++--- .github/workflows/dev_cron/issues_link.js | 4 ++-- .github/workflows/dev_cron/title_check.js | 4 ++-- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/workflows/dev_cron.yml b/.github/workflows/dev_cron.yml index 48ca21510fd9..193549cc077d 100644 --- a/.github/workflows/dev_cron.yml +++ b/.github/workflows/dev_cron.yml @@ -27,15 +27,16 @@ jobs: process: name: Process runs-on: ubuntu-latest + permissions: write-all steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Comment Issues link if: | github.event_name == 'pull_request_target' && (github.event.action == 'opened' || github.event.action == 'edited') - uses: actions/github-script@v3 + uses: actions/github-script@v7 with: github-token: ${{ secrets.GITHUB_TOKEN }} script: | @@ -47,7 +48,7 @@ jobs: github.event_name == 'pull_request_target' && (github.event.action == 'opened' || github.event.action == 'edited') - uses: actions/github-script@v3 + uses: actions/github-script@v7 with: github-token: ${{ secrets.GITHUB_TOKEN }} script: | diff --git a/.github/workflows/dev_cron/issues_link.js b/.github/workflows/dev_cron/issues_link.js index 596bad758532..e47ecb50a55a 100644 --- a/.github/workflows/dev_cron/issues_link.js +++ b/.github/workflows/dev_cron/issues_link.js @@ -35,7 +35,7 @@ async function haveComment(github, context, pullRequestNumber, body) { page: 1 }; while (true) { - const response = await github.issues.listComments(options); + const response = await github.rest.issues.listComments(options); if (response.data.some(comment => comment.body === body)) { return true; } @@ -52,7 +52,7 @@ async function commentISSUESURL(github, context, pullRequestNumber, issuesID) { if (await haveComment(github, context, pullRequestNumber, issuesURL)) { return; } - await github.issues.createComment({ + await github.rest.issues.createComment({ owner: context.repo.owner, repo: context.repo.repo, issue_number: pullRequestNumber, diff --git a/.github/workflows/dev_cron/title_check.js b/.github/workflows/dev_cron/title_check.js index e553e20b025e..1e6df340f2f2 100644 --- a/.github/workflows/dev_cron/title_check.js +++ b/.github/workflows/dev_cron/title_check.js @@ -25,7 +25,7 @@ function haveISSUESID(title) { } async function commentOpenISSUESIssue(github, context, pullRequestNumber) { - const {data: comments} = await github.issues.listComments({ + const {data: comments} = await github.rest.issues.listComments({ owner: context.repo.owner, repo: context.repo.repo, issue_number: pullRequestNumber, @@ -36,7 +36,7 @@ async function commentOpenISSUESIssue(github, context, pullRequestNumber) { } const commentPath = ".github/workflows/dev_cron/title_check.md"; const comment = fs.readFileSync(commentPath).toString(); - await github.issues.createComment({ + await github.rest.issues.createComment({ owner: context.repo.owner, repo: context.repo.repo, issue_number: pullRequestNumber,