newrelic / opensource-website

Source code for New Relic's Opensource site.
https://opensource.newrelic.com
Apache License 2.0
155 stars 89 forks source link

[Sustaining] Update github-scripts #907

Closed aswanson-nr closed 2 years ago

aswanson-nr commented 2 years ago

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

aswanson-nr commented 2 years ago

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

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be automatically closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 2 years ago

This issue has been automatically closed because it was a stale issue that had no recent activity. Thank you for your contributions.