Skip to content

Commit

Permalink
action
Browse files Browse the repository at this point in the history
  • Loading branch information
Astrosp committed Feb 22, 2024
1 parent 15d6069 commit fdf8e63
Showing 1 changed file with 47 additions and 47 deletions.
94 changes: 47 additions & 47 deletions .github/workflows/md-link-check.yml
Original file line number Diff line number Diff line change
@@ -1,52 +1,52 @@
# name: Check Markdown links
name: Check Markdown links

# on: push
on: push

# jobs:
# markdown-link-check:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@master
# - uses: gaurav-nelson/github-action-markdown-link-check@v1
jobs:
markdown-link-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: gaurav-nelson/github-action-markdown-link-check@v1

name: Markdown Link Check
# name: Markdown Link Check

on:
push:
pull_request:
branches:
- dev
# on:
# push:
# pull_request:
# branches:
# - dev

jobs:
link-check:
runs-on: ubuntu-22.04
env:
CI: true
steps:
- name: Setup Action
uses: actions/checkout@master
# - name: Setup Node
# uses: actions/setup-node@v4
# with:
# node-version: 12.x
- name: Install dependencies
run: npm install
- name: Run link check
run: npm run link-check
- name: Show broken links
if: failure()
run: |
cat log | awk -v RS="FILE:" 'match($0, /(\S*\.md).*\[✖\].*(\d*\slinks\schecked\.)(.*)/, arr ) { print "FILE:"arr[1] arr[3] > "brokenlinks"}'
rm -f err log
cat brokenlinks
links=`cat brokenlinks`
links="${links//'%'/'%25'}"
links="${links//$'\n'/'%0A'}"
links="${links//$'\r'/'%0D'}"
echo ::set-output name=links::**Following links are broken:** %0A$links
- name: Send comment to PR with broken links
if: failure() && github.event_name == 'pull_request'
uses: thollander/actions-comment-pull-request@main
with:
message: ${{ steps.brokenlinks.outputs.links }}
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# jobs:
# link-check:
# runs-on: ubuntu-22.04
# env:
# CI: true
# steps:
# - name: Setup Action
# uses: actions/checkout@master
# # - name: Setup Node
# # uses: actions/setup-node@v4
# # with:
# # node-version: 12.x
# - name: Install dependencies
# run: npm install
# - name: Run link check
# run: npm run link-check
# - name: Show broken links
# if: failure()
# run: |
# cat log | awk -v RS="FILE:" 'match($0, /(\S*\.md).*\[✖\].*(\d*\slinks\schecked\.)(.*)/, arr ) { print "FILE:"arr[1] arr[3] > "brokenlinks"}'
# rm -f err log
# cat brokenlinks
# links=`cat brokenlinks`
# links="${links//'%'/'%25'}"
# links="${links//$'\n'/'%0A'}"
# links="${links//$'\r'/'%0D'}"
# echo ::set-output name=links::**Following links are broken:** %0A$links
# - name: Send comment to PR with broken links
# if: failure() && github.event_name == 'pull_request'
# uses: thollander/actions-comment-pull-request@main
# with:
# message: ${{ steps.brokenlinks.outputs.links }}
# # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit fdf8e63

Please sign in to comment.