LinkChecker #115
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: LinkChecker | |
on: | |
schedule: | |
- cron: '0 17 * * 1-5' | |
workflow_dispatch: | |
permissions: | |
contents: read | |
id-token: write | |
jobs: | |
LinkChecker: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 | |
- name: Setup Node.js 20 | |
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 | |
with: | |
node-version: 20.x | |
- name: Install Dependencies | |
run: yarn | |
- name: Run Link Checker | |
id: checkLinks | |
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 | |
with: | |
result-encoding: string | |
script: | | |
const { checkProdLinks } = require('./tasks/link-checker.js'); | |
return await checkProdLinks(); | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2 | |
with: | |
role-to-assume: arn:aws:iam::464149486631:role/github_action_read_slack_webhook_url | |
aws-region: us-west-2 | |
- name: Read secrets from AWS Secrets Manager into environment variables | |
uses: aws-actions/aws-secretsmanager-get-secrets@f91b2a3e784edce744f972af1685eca7e24d2302 # v2.0.2 | |
with: | |
secret-ids: | | |
SLACK_WEBHOOK_URL | |
parse-json-secrets: true | |
- name: Send custom JSON data to Slack workflow | |
if: steps.checkLinks.outputs.result | |
id: slack | |
uses: slackapi/slack-github-action@70cd7be8e40a46e8b0eced40b0de447bdb42f68e # v1.26.0 | |
with: | |
payload: | | |
{ | |
"message": "${{ steps.checkLinks.outputs.result }}" | |
} | |
env: | |
SLACK_WEBHOOK_URL: ${{ env.SLACK_WEBHOOK_URL_SLACK_WEBHOOK_URL }} |