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

60 lines
1.7 KiB
YAML
Raw Normal View History

2021-12-23 20:54:47 +00:00
# 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@v2
2021-12-27 17:12:35 +00:00
- name: Find all markdown files
id: find_files
2021-12-27 17:15:01 +00:00
run: |
2021-12-27 17:45:01 +00:00
echo "::set-output name=files::$(find . -name '*.md' -type f | sed 's|^./||' | tr '\n' ' ')"
2021-12-27 17:22:21 +00:00
2021-12-23 20:54:47 +00:00
- name: Link Checker
id: lychee
uses: lycheeverse/lychee-action@v1.2.0
2021-12-27 17:12:35 +00:00
with:
2021-12-27 17:27:26 +00:00
args: --verbose --no-progress ${{steps.find_files.outputs.files}}
2021-12-23 20:54:47 +00:00
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
2021-12-27 20:23:42 +00:00
- name: Read Markdown
if: ${{ steps.lychee.outputs.exit_code != 0 }}
run: echo "REPORT=$(jq -Rs '.' ./lychee/out.md)" >> $GITHUB_ENV
- name: Slack Notification
if: ${{ steps.lychee.outputs.exit_code != 0 }}
uses: tiloio/slack-webhook-action@v1.0.1
with:
slack_web_hook_url: ${{ secrets.SLACK_WEBHOOK }}
slack_json: |
{
"text": "Link Checker failure in github.com/allegroai/clearl-docs",
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
2021-12-27 20:27:20 +00:00
"text": $REPORT
2021-12-27 20:23:42 +00:00
}
2021-12-27 20:35:05 +00:00
}
2021-12-27 20:23:42 +00:00
]
}