Skip to content

Commit

Permalink
feat: add GitHub workflows for Markdown links checking
Browse files Browse the repository at this point in the history
Two GitHub workflows have been added that perform Markdown links
checking:
* .github/workflows/markdown-link-check-pr.yaml: Executed
  in each PR.
* .github/workflos/markdown-link-check-weekly.yaml: Executed
  Weekly on Mondays at 07:00 UTC.

All the specified md files and directories in the workflows are
intentionally checked, independently on whether they have been
modified or not. The reason for this is that even if a given .md
file has not been modified, its links can become broken. For example,
if a PR moves .md files from directories and some other .md files
contain relative links referencing the old path of the moved files,
then the links become broken even though the file containing the
references not being modified.
  • Loading branch information
miguelsorianod committed Apr 17, 2023
1 parent 0880be9 commit 4acfe07
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 0 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/markdown-link-check-pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: PR check Markdown links

# Only run this workflow on PRs
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]

# Disable permissions for all available scopes for the GITHUB_TOKEN
# except for the metadata scope.
permissions: {}

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
pr-markdown-link-check:
# Only run the job on non-draft PRs
if: "github.event.pull_request.draft == false"
name: Check PR Markdown links
runs-on: ubuntu-latest
steps:
- name: Check out code under the $GITHUB_WORKSPACE directory
uses: actions/checkout@v3
- name: Check markdown links
uses: gaurav-nelson/[email protected]
with:
use-quiet-mode: 'no'
use-verbose-mode: 'yes'
config-file: './.markdown-link-check/markdown-link-check-config.json'
check-modified-files-only: 'no'
file-extension: '.md'
# Unfortunately there's currently not a way to ignore specific
# directories/paths in the GitHub action so we need to specify
# the desired set of directories/paths that we want to check
# in order to avoid checking undesired directories/paths
folder-path: './docs, ./pkg, ./templates, ./.github, ./cmd, ./internal, ./openapi, ./docker, ./scripts'
file-path: './README.md, ./CONTRIBUTING.md'
32 changes: 32 additions & 0 deletions .github/workflows/markdown-link-check-weekly.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Weekly check Markdown links

# Run this workflow every Monday at 07:00 UTC
on:
schedule:
- cron: "0 7 * * 1"

# Disable permissions for all available scopes for the GITHUB_TOKEN
# except for the metadata scope.
permissions: {}

jobs:
weekly-markdown-link-check:
name: Weekly Check Markdown links
runs-on: ubuntu-latest
steps:
- name: Check out code under the $GITHUB_WORKSPACE directory
uses: actions/checkout@v3
- name: Check markdown links
uses: gaurav-nelson/[email protected]
with:
use-quiet-mode: 'no'
use-verbose-mode: 'yes'
config-file: './.markdown-link-check/markdown-link-check-config.json'
check-modified-files-only: 'no'
file-extension: '.md'
# Unfortunately there's currently not a way to ignore specific
# directories/paths in the GitHub action so we need to specify
# the desired set of directories/paths that we want to check
# in order to avoid checking undesired directories/paths
folder-path: './docs, ./pkg, ./templates, ./.github, ./cmd, ./internal, ./openapi, ./docker, ./scripts'
file-path: './README.md, ./CONTRIBUTING.md'

0 comments on commit 4acfe07

Please sign in to comment.