clearml-docs/.github/workflows/links.yml

56 lines
1.8 KiB
YAML

# This is a basic workflow to help you get started with Actions
name: Links
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the main branch
#push:
# branches: [ main ]
#pull_request:
# branches: [ main ]
#schedule:
# - cron: "00 18 * * *"
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
linkChecker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Find all markdown files
id: find_files
run: echo "MD_FILES=$(find . -name '*.md' -type f | sed 's|^./||' | tr '\n' ' ')" >> $GITHUB_ENV
- name: Link Checker
id: lychee
uses: lycheeverse/lychee-action@v1.4.1
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
with:
# Fail action on broken links
fail: true
# Use json as output format (instead of markdown)
# format: json
args: ${{ env.MD_FILES }} --max-concurrency 1 --no-progress --verbose
#- name: Read Results
# if: ${{ steps.lychee.outputs.exit_code != 0 }}
# run: echo "FAILED_URLS=$(jq -r '.fail_map[] | .[] | .url' ./lychee/out.md)" >> $GITHUB_ENV
#- name: Slack Notification
# if: ${{ steps.lychee.outputs.exit_code != 0 }}
# uses: tokorom/action-slack-incoming-webhook@main
# env:
# INCOMING_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}
# with:
# blocks: |
# [
# {"type": "section", "text": {"type": "mrkdwn", "text": ":warning: Link Checker failure in github.com/allegroai/clearml-docs "}},
# {"type": "section", "text": {"type": "mrkdwn", "text": "$FAILED_URLS"}}
# ]