newrelic-quickstarts icon indicating copy to clipboard operation
newrelic-quickstarts copied to clipboard

[Sustaining] Update github-script

Open aswanson-nr opened this issue 3 years ago • 2 comments

Description

The Github action we use to enable/disable branch protection, github-script, is currently on version 5 and we're running version 1. We have also observed 404 errors coming from v1 in the instant-observability-website.

To avoid running into errors let's upgrade our version of github-script.

helpful links

Example changes

before

      - name: Temporarily disable branch protection
        id: disable-branch-protection
        uses: actions/github-script@v1
        with:
          github-token: ${{ secrets.OPENSOURCE_BOT_TOKEN }}
          previews: luke-cage-preview
          script: |
            const result = await github.repos.updateBranchProtection({
              owner: context.repo.owner,
              repo: context.repo.repo,
              branch: 'main',
              required_status_checks: null,
              restrictions: null,
              enforce_admins: null,
              required_pull_request_reviews: null
            })
            console.log("Result:", result)

after

      - name: Temporarily disable branch protection
        id: disable-branch-protection
        uses: actions/github-script@v5
        with:
          github-token: ${{ secrets.OPENSOURCE_BOT_TOKEN }}
          previews: luke-cage-preview
          script: |
            const result = await github.rest.repos.updateBranchProtection({
              owner: context.repo.owner,
              repo: context.repo.repo,
              branch: 'main',
              required_status_checks: null,
              restrictions: null,
              enforce_admins: null,
              required_pull_request_reviews: null
            })
            console.log("Result:", result)

Notice that the changes are just updating the version and add .rest to the call path.

AC

  • [ ] All instances of github-script have been updated to v5

aswanson-nr avatar Jan 25 '22 18:01 aswanson-nr

The 404 error does not appear to be exclusive to v1, however these updates should still be made.

aswanson-nr avatar Jan 27 '22 21:01 aswanson-nr

Old issues will be closed after 105 days of inactivity. This issue has been quiet for 90 days and is being marked as stale. Reply here to keep this issue open.

github-actions[bot] avatar Apr 28 '22 02:04 github-actions[bot]

This issue is being closed due to inactivity. Is this a mistake? Please re-open this issue or create a new one.

github-actions[bot] avatar Mar 27 '23 01:03 github-actions[bot]