Skip to content

try to add a comment if lychee exit code isnt 0 #8

try to add a comment if lychee exit code isnt 0

try to add a comment if lychee exit code isnt 0 #8

Workflow file for this run

name: Dead Links (Fail Fast)
on:
pull_request:
jobs:
check-links-pr:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Link Checker
uses: lycheeverse/lychee-action@v1.9.0
with:
fail: true
args: --base . --verbose --no-progress 'README.md'
- name: Broken Link Detected
if: env.lychee_exit_code != 0
uses: actions/github-script@v6
with:
script: |
let fs = require('fs');
let report = fs.readFileSync('./lychee/out.md');
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: String(report)
})