Skip to content

ci: Exempt Dependabot PRs from PR title validation #348

ci: Exempt Dependabot PRs from PR title validation

ci: Exempt Dependabot PRs from PR title validation #348

---
name: Validate Markdown
# yamllint disable-line rule:truthy
on:
pull_request:
workflow_dispatch:
jobs:
markdown-lint:
name: Markdown Lint
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v6
with:
fetch-depth: '0'
# https://github.com/marketplace/actions/markdownlint-cli2-action
- name: Identify changed files
uses: tj-actions/changed-files@v47
id: changed-files
with:
files: '**/*.md'
separator: ","
# https://github.com/marketplace/actions/markdownlint-cli2-action
- name: Markdown Lint
uses: DavidAnson/markdownlint-cli2-action@v23
if: steps.changed-files.outputs.any_changed == 'true'
with:
globs: ${{ steps.changed-files.outputs.all_changed_files }}
separator: ","
config: '.rules/.markdownlint.jsonc'
fix: true
# https://github.com/edwardtfn/NSPanel-Easy/pull/1#pullrequestreview-3730634846
- name: Commit fixes
if: >-
steps.changed-files.outputs.any_changed == 'true' &&
github.event_name == 'pull_request' &&
github.event.pull_request.head.repo.full_name == github.repository
uses: stefanzweifel/git-auto-commit-action@v7
with:
commit_message: "style: auto-fix markdown lint issues"
file_pattern: '**/*.md'
markdown-links:
name: Check links
permissions:
contents: read
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v6
with:
fetch-depth: '0'
- name: Detect changed Markdown files
id: changed
if: github.event_name == 'pull_request'
uses: step-security/changed-files@v47.0.5
with:
files: '**/*.md'
# https://github.com/tcort/github-action-markdown-link-check
- name: Markdown links
if: github.event_name != 'pull_request' || steps.changed.outputs.any_changed == 'true'
uses: tcort/github-action-markdown-link-check@v1.1.2
with:
# yamllint disable-line rule:truthy
check-modified-files-only: yes
config-file: '.rules/mlc_config.json'
base-branch: 'main'
# ===========================================================================
# Gate — required status check for branch protection
# ===========================================================================
all-checks-passed:
name: Validate Markdown / All checks passed
runs-on: ubuntu-latest
permissions: {}
needs:
- markdown-lint
- markdown-links
if: always()
steps:
- name: Check all jobs passed
run: |
results=(
"markdown-lint=${{ needs.markdown-lint.result }}"
"markdown-links=${{ needs.markdown-links.result }}"
)
failed=false
for entry in "${results[@]}"; do
job="${entry%%=*}"
result="${entry##*=}"
echo "${job}: ${result}"
case "${result}" in
success|skipped) ;;
*) failed=true ;;
esac
done
if [ "${failed}" = "true" ]; then
echo "One or more jobs failed or were cancelled."
exit 1
fi
echo "All jobs passed or were skipped."
...