Update Redirect Links #880
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Update Redirect Links | |
| permissions: | |
| contents: write | |
| on: | |
| # Triggered by https://github.com/nodejs/node/blob/main/.github/workflows/update-release-links.yml | |
| workflow_dispatch: | |
| schedule: | |
| - cron: '0 0 * * *' | |
| concurrency: | |
| group: update-redirect-links | |
| cancel-in-progress: false | |
| jobs: | |
| update-redirect-links: | |
| name: Update Redirect Links | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1 | |
| with: | |
| egress-policy: block | |
| allowed-endpoints: > | |
| api.github.com:443 | |
| dist-prod.07be8d2fbc940503ca1be344714cb0d1.r2.cloudflarestorage.com:443 | |
| github.com:443 | |
| hooks.slack.com:443 | |
| registry.npmjs.org:443 | |
| - name: Git Checkout | |
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| - name: Cache Dependencies | |
| uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 | |
| with: | |
| path: | | |
| ~/.npm | |
| node_modules/.cache | |
| key: ${{ runner.os }}-npm-${{ hashFiles('**/workflows/format.yml') }} | |
| restore-keys: ${{ runner.os }}-npm- | |
| - name: Setup Node | |
| uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0 | |
| with: | |
| node-version: lts/* | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci && npm update nodejs-latest-linker --save | |
| - name: Update Redirect Links | |
| run: node scripts/build-r2-symlinks.mjs && node --run format | |
| env: | |
| CF_ACCESS_KEY_ID: ${{ secrets.CF_ACCESS_KEY_ID }} | |
| CF_SECRET_ACCESS_KEY: ${{ secrets.CF_SECRET_ACCESS_KEY }} | |
| - name: Commit Changes | |
| id: git_auto_commit | |
| uses: stefanzweifel/git-auto-commit-action@b863ae1933cb653a53c021fe36dbb774e1fb9403 # v5.2.0 | |
| with: | |
| commit_options: '--no-verify --no-signoff' | |
| commit_message: 'chore: update redirect links' | |
| branch: update-redirect-links | |
| create_branch: true | |
| - name: Open and Merge Pull Request | |
| if: steps.git_auto_commit.outputs.changes_detected == 'true' | |
| run: | | |
| gh pr create --fill | |
| gh pr merge --squash --delete-branch --admin | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GH_BOT_TOKEN }} | |
| - name: Deploy to Production | |
| if: steps.git_auto_commit.outputs.changes_detected == 'true' | |
| run: | | |
| gh workflow run deploy.yml | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GH_BOT_TOKEN }} | |
| - name: Alert on Failure | |
| if: failure() && github.repository == 'nodejs/release-cloudflare-worker' | |
| uses: rtCamp/action-slack-notify@e31e87e03dd19038e411e38ae27cbad084a90661 # 2.3.3 | |
| env: | |
| SLACK_COLOR: '#DE512A' | |
| SLACK_ICON: https://github.com/nodejs.png?size=48 | |
| SLACK_TITLE: Update links failed (${{ github.ref }}) | |
| SLACK_MESSAGE: The `update-links.yml` action has failed. | |
| SLACK_USERNAME: nodejs-bot | |
| SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} |