Skip to content

Commit

Permalink
chore: update links.yml config (#1345)
Browse files Browse the repository at this point in the history
* Update links.yml

Running the workflow manually (see https://github.com/celo-org/docs/actions/runs/9679044164/job/26704145144) fails on creating a ticket because the body is too big (see peter-evans/create-issue-from-file#1049).

This PR aims to reduce the amount of failures to be reported by
- adding caching and a GITHUB_TOKEN as per instructions at https://lychee.cli.rs/github_action_recipes/caching/#caching-in-github-actions for speed
- removing the progression indication (recommended for CI)
- adding verbose logging

* Add more file extensions

* Remove the `base` argument

* Update create-issue-from-file to v5

* Check the size of the output before creating an issue, otherwise fail the workflow
  • Loading branch information
lvpeschke authored Jun 27, 2024
1 parent a4172f0 commit d9dd9b3
Showing 1 changed file with 37 additions and 1 deletion.
38 changes: 37 additions & 1 deletion .github/workflows/links.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,52 @@ on:
jobs:
linkChecker:
runs-on: ubuntu-latest

steps:
- name: Restore lychee cache
id: restore-cache
uses: actions/cache@v4
with:
path: .lycheecache
key: cache-lychee-${{ github.sha }}
restore-keys: cache-lychee-

- uses: actions/checkout@v4

- name: Link Checker
id: lychee
uses: lycheeverse/lychee-action@v1
with:
args: >-
--verbose
--no-progress
--cache --max-cache-age 1d
'./**/*.html'
'./**/*.js'
'./**/*.md'
'./**/*.rst'
'./**/*.tsx'
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

- name: Check Output Size and Exit If Too Large
id: wc
shell: bash
run: |
# See https://github.com/peter-evans/create-issue-from-file/issues/1049
if [ "$(wc -m < ./lychee/out.md)" -gt 65536 ]; then
echo "Link Checker output is too big (> 65536 characters) for a GitHub Issue descriptions."
exit 1
fi
createIssue:
runs-on: ubuntu-latest
needs: linkChecker

steps:
- name: Create Issue From File
if: env.lychee_exit_code != 0
uses: peter-evans/create-issue-from-file@v4
uses: peter-evans/create-issue-from-file@v5
with:
title: Link Checker Report
content-filepath: ./lychee/out.md
Expand Down

0 comments on commit d9dd9b3

Please sign in to comment.