Markdown #253
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: "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/[email protected]" | |
with: | |
fetch-depth: 0 | |
- name: "Get all changed files" | |
id: "markdown-files" | |
uses: "tj-actions/[email protected]" | |
with: | |
files: "${{ env.SEARCH_PATTERN }}" | |
- name: "Run linter for all changed files" | |
uses: "DavidAnson/[email protected]" | |
with: | |
globs: "${{ steps.markdown-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/[email protected]" | |
with: | |
fetch-depth: 0 | |
- name: "Set up repository with the latest commit" | |
if: "${{ env.IS_SCHEDULE_OR_WORKFLOW_DISPATCH_EVENT == vars.POSITIVE }}" | |
uses: "actions/[email protected]" | |
- name: "Get all changed files" | |
id: "markdown-files" | |
if: "${{ env.IS_PUSH_OR_PULL_REQUEST_EVENT == vars.POSITIVE }}" | |
uses: "tj-actions/[email protected]" | |
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/[email protected]" | |
with: | |
args: "${{ steps.markdown-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/[email protected]" | |
with: | |
args: "'**/*.md'" | |
fail: true | |
failIfEmpty: false | |
- 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/[email protected]" | |
with: | |
title: "Inaccessible Markdown links found" | |
assignees: "${{ github.repository_owner }}" | |
labels: | | |
priority: medium | |
status: pending | |
content-filepath: "lychee/out.md" |