Skip to content

Commit

Permalink
Merge branch 'main' into consolidate_save_load_tutorials
Browse files Browse the repository at this point in the history
  • Loading branch information
Saiteja64 authored Oct 30, 2024
2 parents 400efb1 + c7e1819 commit af630c5
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions .github/workflows/link_checkPR.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,52 @@
#Checks links in a PR to ensure they are valid. If link is valid but failing, it can be added to the .lycheeignore file
#Use the skip-link-check label on a PR to skip checking links on a PR

name: link check on PR

on:
pull_request:
branches: [main]

jobs:
linkChecker:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Get Changed Files
id: changed-files
uses: tj-actions/changed-files@v41

- name: Check for Skip Label
id: skip-label
uses: actions/github-script@v6
with:
script: |
const labels = await github.rest.issues.listLabelsOnIssue({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number
});
return labels.data.some(label => label.name === 'skip-link-check');
- name: Check Links
if: steps.skip-label.outputs.result == 'false'
uses: lycheeverse/lychee-action@v1
with:
args: --accept=200,403,429 --base . --verbose --no-progress ${{ steps.changed-files.outputs.all_changed_files }}
token: ${{ secrets.CUSTOM_TOKEN }}
fail: true

- name: Skip Message
if: steps.skip-label.outputs.result == 'true'
run: echo "Link check was skipped due to the presence of the 'skip-link-check' label."

- name: Suggestions
if: failure()
run: |
echo -e "\nPlease review the links reported in the Check links step above."
echo -e "If a link is valid but fails due to a CAPTCHA challenge, IP blocking, login requirements, etc.,
consider adding such links to .lycheeignore file to bypass future checks.\n"
echo -e "If a link is valid but fails due to a CAPTCHA challenge, IP blocking, login requirements, etc., consider adding such links to .lycheeignore file to bypass future checks.\n"
exit 1

0 comments on commit af630c5

Please sign in to comment.