try to add a comment if lychee exit code isnt 0 #9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/[email protected] | |
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) | |
}) |