Skip to content

Check links on neo4j.com #4

Check links on neo4j.com

Check links on neo4j.com #4

name: Check links on neo4j.com
on:
workflow_call:
inputs:
docs-path:
description: 'The path to the docs to check'
type: string
default: 'https://neo4j.com/docs'
docset:
description: 'The doc set to check'
type: string
default: 'operations-manual'
skipfile:
description: 'The path to the skipfile'
type: string
default: '.docs-tools/link-checker/ignore-links.txt'
retain-artifacts:
description: 'The number of days to retain artifacts'
type: number
default: 7
workflow_dispatch:
inputs:
docs-path:
description: 'The path to the docs to check'
type: string
default: 'https://neo4j.com/docs'
docset:
description: 'The doc set to check'
type: string
default: 'operations-manual'
skipfile:
description: 'The path to the skipfile'
type: string
default: '.docs-tools/link-checker/ignore-links.txt'
retain-artifacts:
description: 'The number of days to retain artifacts'
type: number
default: 7
jobs:
check-links:
runs-on: ubuntu-latest
env:
DOCS_PATH: ${{ inputs.docs-path }}
DOCSET: ${{ inputs.docset }}
SKIPFILE: ${{ inputs.skipfile }}
steps:
- name: Checkout tools repo
uses: actions/checkout@v4
with:
repository: neo4j/docs-tools
ref: dev
sparse-checkout: |
link-checker
path: .docs-tools
- name: Use Node.js 16
uses: actions/setup-node@v3
with:
node-version: '16'
# - name: Install link checker
# run: npm install github:recrwplay/link-checker#v0.2.0
- name: Run link checker
uses: filiph/[email protected]
with:
arguments: $DOCS_PATH/$DOCSET --skip-file $SKIPFILE -e
# - name: Run link checker
# run: |
# npx link-checker $DOCS_PATH/$DOCSET --skip-file $SKIPFILE -e |& tee link-log.txt
# warncount=$(grep -e "[0-9]* warnings" -o link-log.txt | sed 's/ warnings//' )
# if [ $warncount -gt 0 ]; then
# echo "::warning:: $warncount warnings"
# fi
# errorcount=$(grep -e "[0-9]* errors" -o link-log.txt | sed 's/ errors//' )
# if [ $errorcount -gt 0 ]; then
# echo "::error:: Errors found: See the output of the Check links step for details"
# exit 1
# fi
# upload artifacts
- name: Save log
uses: actions/upload-artifact@v3
with:
name: linklog
path: link-log.txt
# if errors, raise an issue in the repo and exit 1 to fail the workflow
# tbc...
# create an action. action needs authed token. attach log to issue. extract errors as issue text?