links #1403
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: links | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "0 6 * * *" # Every day at 6am | |
pull_request: | |
branches: ["main"] | |
push: | |
branches: ["main"] | |
jobs: | |
check: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Generate Token | |
id: generate-token | |
uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a # v2.1.0 | |
with: | |
app_id: "${{ secrets.BOT_APP_ID }}" | |
private_key: "${{ secrets.BOT_APP_PRIVATE_KEY }}" | |
- name: Checkout repo | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 | |
- name: Scan for broken links | |
uses: lycheeverse/lychee-action@2b973e86fc7b1f6b36a93795fe2c9c6ae1118621 # v1 | |
id: lychee | |
env: | |
GITHUB_TOKEN: "${{ steps.app-token.outputs.token }}" | |
with: | |
args: > | |
--verbose | |
--exclude-mail | |
'./**/*.md' | |
- name: Find Broken links issues | |
id: broken-link-check-issue | |
uses: micalevisk/last-issue-action@0d40124cc99ac8601c2516007f0c98ef3d27537b # v2 | |
with: | |
state: all | |
labels: | | |
broken-links | |
- name: Update issues | |
if: env.lychee_exit_code != 0 | |
uses: peter-evans/create-issue-from-file@24452a72d85239eacf1468b0f1982a9f3fec4c94 # v5 | |
with: | |
title: Broken links detected 🔗 | |
issue-number: "${{ steps.broken-link-check-issue.outputs.issue-number }}" | |
content-filepath: ./lychee/out.md | |
token: "${{ steps.generate-token.outputs.token }}" | |
labels: | | |
broken-links | |
- name: Close open issues | |
if: env.lychee_exit_code == 0 && steps.broken-link-check-issue.outputs.has-found == true | |
uses: peter-evans/close-issue@276d7966e389d888f011539a86c8920025ea0626 # v3 | |
with: | |
token: "${{ steps.generate-token.outputs.token }}" | |
issue-number: "${{ steps.broken-link-check-issue.outputs.issue-number }}" |