Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add github workflow to check links and open issues reporting them #1028

Merged
merged 1 commit into from
Dec 11, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 85 additions & 0 deletions .github/workflows/links_checker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Links Checker

on:
## Allow triggering this workflow manually via GitHub CLI/web
workflow_dispatch:

## Run this workflow automatically every month
schedule:
- cron: '0 0 1 * *'

jobs:
link_checker:
name: Check links and create automated issue if needed
runs-on: ubuntu-latest
timeout-minutes: 5
env:
REPORT_FILE: links-report
steps:
## Check out code using Git
- uses: actions/checkout@v2

- name: Check all links at README.md and translations files
id: lychee
uses: lycheeverse/[email protected]
with:
output: ${{ env.REPORT_FILE }}
format: markdown
## Do not fail this step on broken links
fail: false
## Allow pages replying with 200 (Ok), 204 (No Content),
## 206 (Partial Content) in at most 20 seconds with HTML content.
args: >-
--verbose
--accept 200,204,206
--headers "accept=text/html"
--timeout 20
--max-concurrency 5
--no-progress
README.md translations/*.md
env:
## Avoid rate limiting when checking github.com links
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Lychee's exit code
## https://github.com/lycheeverse/lychee#exit-codes
run: echo Lychee exit with ${{ steps.lychee.outputs.exit_code }}

- name: Find the last report issue open
uses: micalevisk/last-issue-action@v1
id: last_issue
with:
state: open
labels: |
report
automated issue
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Create issue from report file
if: ${{ steps.last_issue.outputs.has_found == 'false' }}
uses: peter-evans/create-issue-from-file@v3
with:
title: Link checker report
content-filepath: ${{ env.REPORT_FILE }}
issue-number: ${{ steps.last_issue.outputs.issue_number }}
labels: |
report
automated issue

- name: Update last report open issue created
if: ${{ steps.last_issue.outputs.has_found == 'true' }}
uses: peter-evans/create-issue-from-file@v3
with:
title: Link checker report
content-filepath: ${{ env.REPORT_FILE }}
issue-number: ${{ steps.last_issue.outputs.issue_number }}
labels: |
report
automated issue

- name: Close last report open issue
if: ${{ steps.lychee.outputs.exit_code == 0 }}
uses: peter-evans/close-issue@v1
with:
issue-number: ${{ steps.last_issue.outputs.issue_number }}