Check all URLs #124
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 of workflow | |
name: Check all URLs | |
# Run workflow once a week | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '15 1 * * 1' | |
# Steps to carry out | |
jobs: | |
build: | |
# Create a ubuntu virtual machine | |
runs-on: ubuntu-latest | |
# Checkout repo code | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v2 | |
# Install node | |
- name: Use Node.js | |
uses: actions/setup-node@v1 | |
with: | |
node-version: 10.16 | |
- run: npm install | |
- run: npm run build --if-present | |
- run: npm test | |
env: | |
CI: true | |
# Run script checkURLsinMarkdown.js | |
# Show the results | |
- name: Check URLs | |
run: |- | |
node checkURLsInMarkdown.js | |
echo "::set-output name=errors::$(grep '^\[ERROR' urlCheck.txt |wc -l)" | |
echo "::set-output name=codes404::$(grep '^\[404' urlCheck.txt |wc -l)" | |
id: check | |
# Make the output file available as an artifact | |
- name: Uploading artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: urlCheck | |
path: urlCheck.txt | |
# Create an issue with the number of errors found | |
- name: Create an issue | |
uses: JasonEtco/create-an-issue@v2 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
ERRORS: ${{ steps.check.outputs.errors }} | |
CODES404: ${{ steps.check.outputs.codes404 }} | |
with: | |
filename: .github/checkURL-template.md |