From ff82a8750e99496f5217a25e2610e5e914afbfee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Collonval?= Date: Tue, 3 Jan 2023 09:30:59 +0100 Subject: [PATCH 1/2] Update github-script action --- doc/howto/binder-badge.yaml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/doc/howto/binder-badge.yaml b/doc/howto/binder-badge.yaml index 3d8d210..a6b1bff 100644 --- a/doc/howto/binder-badge.yaml +++ b/doc/howto/binder-badge.yaml @@ -1,23 +1,24 @@ #./.github/workflows/binder-badge.yaml name: Binder Badge -on: +on: pull_request_target: types: [opened] +permissions: + pull-requests: write + jobs: binder: runs-on: ubuntu-latest - permissions: - pull-requests: write steps: - name: comment on PR with Binder link - uses: actions/github-script@v3 + uses: actions/github-script@v6 with: github-token: ${{secrets.GITHUB_TOKEN}} script: | var PR_HEAD_USERREPO = process.env.PR_HEAD_USERREPO; var PR_HEAD_REF = process.env.PR_HEAD_REF; - github.issues.createComment({ + github.rest.issues.createComment({ issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, From 2ae9c15e2c13ee8b500064b3bcc1de1348197934 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Collonval?= Date: Tue, 3 Jan 2023 09:34:27 +0100 Subject: [PATCH 2/2] Update all workflows --- doc/howto/binder-badge-permissions.yaml | 4 ++-- doc/howto/binder-badge.yaml | 5 ++--- doc/howto/chatops-binder.yaml | 8 ++++---- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/doc/howto/binder-badge-permissions.yaml b/doc/howto/binder-badge-permissions.yaml index 857d182..174b723 100644 --- a/doc/howto/binder-badge-permissions.yaml +++ b/doc/howto/binder-badge-permissions.yaml @@ -16,12 +16,12 @@ jobs: pull-requests: write steps: - name: comment on PR with Binder link - uses: actions/github-script@v3 + uses: actions/github-script@v6 with: github-token: ${{secrets.GITHUB_TOKEN}} script: | var BRANCH_NAME = process.env.BRANCH_NAME; - github.issues.createComment({ + github.rest.issues.createComment({ issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, diff --git a/doc/howto/binder-badge.yaml b/doc/howto/binder-badge.yaml index a6b1bff..29cbccf 100644 --- a/doc/howto/binder-badge.yaml +++ b/doc/howto/binder-badge.yaml @@ -4,12 +4,11 @@ on: pull_request_target: types: [opened] -permissions: - pull-requests: write - jobs: binder: runs-on: ubuntu-latest + permissions: + pull-requests: write steps: - name: comment on PR with Binder link uses: actions/github-script@v6 diff --git a/doc/howto/chatops-binder.yaml b/doc/howto/chatops-binder.yaml index 950a22f..5dc414b 100644 --- a/doc/howto/chatops-binder.yaml +++ b/doc/howto/chatops-binder.yaml @@ -5,19 +5,19 @@ on: [issue_comment] # issues and PRs are equivalent in terms of comments for the jobs: trigger-chatops: # Make sure the comment is on a PR, and contains the command "/binder" - if: (github.event.issue.pull_request != null) && contains(github.event.comment.body, '/binder') + if: (github.event.issue.pull_request != null) && contains(github.event.comment.body, '/binder') runs-on: ubuntu-latest steps: # Use the GitHub API to: # (1) Get the branch name of the PR that has been commented on with "/binder" # (2) make a comment on the PR with the binder badge - name: comment on PR with Binder link - uses: actions/github-script@v3 + uses: actions/github-script@v6 with: github-token: ${{secrets.GITHUB_TOKEN}} script: | // Get the branch name - github.pulls.get({ + github.rest.pulls.get({ owner: context.repo.owner, repo: context.repo.repo, pull_number: context.payload.issue.number @@ -25,7 +25,7 @@ jobs: // use the branch name to make a comment on the PR with a Binder badge var BRANCH_NAME = pr.data.head.ref - github.issues.createComment({ + github.rest.issues.createComment({ issue_number: context.payload.issue.number, owner: context.repo.owner, repo: context.repo.repo,