Skip to content

Markdown

Markdown #60

Workflow file for this run

name: "Markdown"
on:
push:
branches:
- "main"
paths:
- "**.md"
pull_request:
paths:
- "**.md"
schedule:
- cron: "0 0 */2 * *"
workflow_dispatch:
concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true
env:
SEARCH_PATTERN: "**.md"
jobs:
linter:
name: "Linter"
if: "${{ github.event_name == 'push' || github.event_name == 'pull_request' }}"
runs-on: "${{ vars.DEFAULT_UBUNTU }}"
steps:
- name: "Set up repository with all history"
uses: "actions/checkout@v4.1.2"
with:
fetch-depth: 0
- name: "Get all changed files"
id: "changed-files"
uses: "tj-actions/changed-files@v43.0.0"
with:
files: "${{ env.SEARCH_PATTERN }}"
- name: "Run linter for all changed files"
uses: "DavidAnson/markdownlint-cli2-action@v15.0.0"
with:
globs: "${{ steps.changed-files.outputs.all_changed_files }}"
link-checker:
name: "Link checker"
runs-on: "${{ vars.DEFAULT_UBUNTU }}"
env:
IS_PUSH_EVENT: "${{ github.event_name == 'push' }}"
IS_PUSH_OR_PULL_REQUEST_EVENT: "${{ github.event_name == 'push' || github.event_name == 'pull_request' }}"
IS_SCHEDULE_OR_WORKFLOW_DISPATCH_EVENT: "${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}"
steps:
- name: "Set up repository with all history"
if: "${{ env.IS_PUSH_OR_PULL_REQUEST_EVENT == vars.POSITIVE }}"
uses: "actions/checkout@v4.1.2"
with:
fetch-depth: 0
- name: "Set up repository with the latest commit"
if: "${{ env.IS_SCHEDULE_OR_WORKFLOW_DISPATCH_EVENT == vars.POSITIVE }}"
uses: "actions/checkout@v4.1.2"
- name: "Get all changed files"
id: "changed-files"
if: "${{ env.IS_PUSH_OR_PULL_REQUEST_EVENT == vars.POSITIVE }}"
uses: "tj-actions/changed-files@v43.0.0"
with:
files: "${{ env.SEARCH_PATTERN }}"
- name: "Run link checker for all changed files"
if: "${{ env.IS_PUSH_OR_PULL_REQUEST_EVENT == vars.POSITIVE }}"
uses: "lycheeverse/lychee-action@v1.9.3"
with:
args: "${{ steps.changed-files.outputs.all_changed_files }}"
fail: true
- name: "Run link checker for all files"
if: "${{ env.IS_SCHEDULE_OR_WORKFLOW_DISPATCH_EVENT == vars.POSITIVE }}"
uses: "lycheeverse/lychee-action@v1.9.3"
with:
args: "'**/*.md'"
fail: true
- name: "Create issue if inaccessible links are found"
if: "${{ (env.IS_PUSH_EVENT == vars.POSITIVE || env.IS_SCHEDULE_OR_WORKFLOW_DISPATCH_EVENT == vars.POSITIVE) && failure() }}"
uses: "peter-evans/create-issue-from-file@v5.0.0"
with:
title: "Inaccessible Markdown links found"
assignees: "${{ github.repository_owner }}"
labels: |
priority: medium
status: pending
content-filepath: "lychee/out.md"