Broken link check workflow #21
This file contains 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: Broken link check (va.gov) | |
on: | |
workflow_dispatch: | |
pull_request: | |
concurrency: | |
group: broken-links-check | |
cancel-in-progress: true | |
env: | |
SLACK_CHANNEL: C06DSBT7CBW #status-next-build | |
DSVA_SCHEDULE_ENABLED: true | |
TOTAL_INSTANCES: 32 | |
jobs: | |
broken-links-check: | |
name: Broken link check | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
max-parallel: 32 | |
matrix: | |
# Strictly speaking total_instances doesn't need to be part of the | |
# matrix; but it's convenient. | |
instance_number: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version-file: .nvmrc | |
- name: Install Npm Dependencies | |
run: | | |
yarn set version 3.6.1 | |
HUSKY=0 yarn install --immutable | |
- name: Build proxy-fetcher dist | |
run: | | |
yarn tsc -b ./packages/proxy-fetcher/tsconfig.json | |
- name: Rebuild combined cert | |
run: | | |
yarn certs | |
- name: Run broken link check | |
run: | | |
TOTAL_INSTANCES=${{ env.TOTAL_INSTANCES }} INSTANCE_NUMBER=${{ matrix.instance_number }} APP_ENV=gha NODE_EXTRA_CA_CERTS=certs/VA-mozilla-combined.pem SITE_URL=https://va.gov/ node --max-old-space-size=4000 scripts/check-broken-links.mjs | |
- name: Rename broken link json | |
id: rename-report-file | |
run: | | |
mv broken-links-report.json "broken-links-report-run-${{github.run_id}}-instance-${{ matrix.instance_number }}.json" | |
- id: upload-report-json | |
uses: actions/upload-artifact@v4 | |
with: | |
name: "broken-links-report-run-${{github.run_id}}-instance-${{ matrix.instance_number }}.json" | |
path: broken-links-report-run-${{github.run_id}}-instance-${{ matrix.instance_number }}.json | |
retention-days: 1 | |
create-combined-reports: | |
name: Create combined reports | |
needs: broken-links-check | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version-file: .nvmrc | |
- name: Install Npm Dependencies | |
run: | | |
yarn set version 3.6.1 | |
HUSKY=0 yarn install --immutable | |
- name: Download link reports | |
uses: actions/download-artifact@v4 | |
- name: List files | |
run: ls -al | |
# - name: Prepare Slack payload | |
# run: | | |
# node scripts/broken-links-slack-payload.mjs -m ${{ steps.upload-report-markdown.outputs.artifact-url }} -i ${{ steps.rename-report-file.outputs.REPORT_FILE}} | |
# - name: Export Slack payload | |
# id: export-slack-payload | |
# run: echo SLACK_PAYLOAD=$(cat broken-links-slack-payload.json) >> $GITHUB_OUTPUT | |
# notify-success: | |
# name: Notify Success | |
# runs-on: ubuntu-latest | |
# needs: broken-links-check | |
# steps: | |
# - name: Checkout | |
# uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
# - name: Notify Slack | |
# uses: department-of-veterans-affairs/platform-release-tools-actions/slack-notify@8c496a4b0c9158d18edcd9be8722ed0f79e8c5b4 # main | |
# continue-on-error: true | |
# with: | |
# payload: ${{ needs.broken-links-check.outputs.SLACK_PAYLOAD }} | |
# channel_id: ${{ env.SLACK_CHANNEL }} | |
# aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
# aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
# notify-failure: | |
# name: Notify Failure | |
# runs-on: ubuntu-latest | |
# if: ${{ failure() || cancelled() }} | |
# needs: broken-links-check | |
# steps: | |
# - name: Checkout | |
# uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
# - name: Notify Slack | |
# if: ${{ env.DSVA_SCHEDULE_ENABLED == 'true' }} | |
# uses: department-of-veterans-affairs/platform-release-tools-actions/slack-notify@8c496a4b0c9158d18edcd9be8722ed0f79e8c5b4 # main | |
# continue-on-error: true | |
# with: | |
# payload: '{"attachments": [{"color": "#D33834","blocks": [{"type": "section","text": {"type": "mrkdwn","text": ">!here< New next-build release could not be tagged!: <https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}>"}}]}]}' | |
# channel_id: ${{ env.SLACK_CHANNEL }} | |
# aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
# aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} |