|
| 1 | +#/ |
| 2 | +# @license Apache-2.0 |
| 3 | +# |
| 4 | +# Copyright (c) 2021 The Stdlib Authors. |
| 5 | +# |
| 6 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | +# you may not use this file except in compliance with the License. |
| 8 | +# You may obtain a copy of the License at |
| 9 | +# |
| 10 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | +# |
| 12 | +# Unless required by applicable law or agreed to in writing, software |
| 13 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | +# See the License for the specific language governing permissions and |
| 16 | +# limitations under the License. |
| 17 | +#/ |
| 18 | + |
| 19 | +# Workflow name: |
| 20 | +name: broken_markdown_links |
| 21 | + |
| 22 | +# Workflow triggers: |
| 23 | +on: |
| 24 | + schedule: |
| 25 | + # Run the workflow once a month on the 1st day of every month. |
| 26 | + - cron: "0 0 1 * *" |
| 27 | + |
| 28 | + # Allow the workflow to be manually run: |
| 29 | + workflow_dispatch: |
| 30 | + |
| 31 | +# Workflow jobs: |
| 32 | +jobs: |
| 33 | + |
| 34 | + # Define a job for detecting broken links in Markdown files... |
| 35 | + broken_markdown_links: |
| 36 | + |
| 37 | + # Define a display name: |
| 38 | + name: 'Detect broken links in Markdown files' |
| 39 | + |
| 40 | + # Define the type of virtual host machine: |
| 41 | + runs-on: ubuntu-latest |
| 42 | + |
| 43 | + # Define the sequence of job steps... |
| 44 | + steps: |
| 45 | + |
| 46 | + # Checkout the repository: |
| 47 | + - name: 'Checkout repository' |
| 48 | + uses: actions/checkout@v2 |
| 49 | + with: |
| 50 | + # Specify whether to remove untracked files before checking out the repository: |
| 51 | + clean: true |
| 52 | + |
| 53 | + # Limit clone depth to the most recent commit: |
| 54 | + fetch-depth: 1 |
| 55 | + |
| 56 | + # Specify whether to download Git-LFS files: |
| 57 | + lfs: false |
| 58 | + timeout-minutes: 10 |
| 59 | + # Run the command to check for broken links: |
| 60 | + - id: broken-links |
| 61 | + uses: stdlib-js/broken-markdown-url-definitions-action@v1.0 |
| 62 | + with: |
| 63 | + directory: fixtures |
| 64 | + # Print out the results: |
| 65 | + - run: | |
| 66 | + echo ${{ steps.broken-links.outputs.links }} |
| 67 | + echo Status: ${{ steps.broken-links.outputs.status }} |
| 68 | + # Fail the workflow if the status is not "success": |
| 69 | + - if: ${{ steps.broken-links.outputs.status }} != 'success' |
| 70 | + run: | |
| 71 | + exit 1 |
0 commit comments