Create content auto-fix PR #422
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: Create content auto-fix PR | |
on: | |
schedule: | |
- cron: "0 0 * * *" | |
workflow_dispatch: | |
# No GITHUB_TOKEN permissions, as we only use it to increase API limit. | |
# We use AUTOMERGE_TOKEN to create the PR. | |
permissions: {} | |
jobs: | |
fix: | |
if: github.repository == 'mdn/content' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Node.js environment | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: ".nvmrc" | |
cache: yarn | |
- name: Install all yarn packages | |
run: yarn --frozen-lockfile | |
env: | |
# https://github.com/microsoft/vscode-ripgrep#github-api-limit-note | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
HUSKY: 0 | |
- name: Lint markdown files | |
run: | | |
yarn content fix-flaws | |
yarn fix:md | |
yarn fix:fm | |
node scripts/sort_and_unique_file_lines.js .vscode/dictionaries | |
- name: Create PR with only fixable issues | |
if: success() | |
uses: peter-evans/create-pull-request@67ccf781d68cd99b580ae25a5c18a1cc84ffff1f # v7.0.6 | |
with: | |
commit-message: "chore: auto-fix Markdownlint, Prettier, and front-matter issues" | |
branch: markdownlint-auto-cleanup | |
title: "fix: auto-cleanup by bot" | |
author: mdn-bot <108879845+mdn-bot@users.noreply.github.com> | |
committer: mdn-bot <108879845+mdn-bot@users.noreply.github.com> | |
body: | | |
All issues auto-fixed | |
labels: | | |
automated pr | |
token: ${{ secrets.AUTOMERGE_TOKEN }} | |
- name: Create PR with notice on unfixed issues | |
if: failure() | |
uses: peter-evans/create-pull-request@67ccf781d68cd99b580ae25a5c18a1cc84ffff1f # v7.0.6 | |
with: | |
commit-message: "chore: auto-fix Markdownlint, Prettier, and front-matter issues" | |
branch: markdownlint-auto-cleanup | |
title: "fix: auto-cleanup by bot" | |
author: mdn-bot <108879845+mdn-bot@users.noreply.github.com> | |
committer: mdn-bot <108879845+mdn-bot@users.noreply.github.com> | |
body: | | |
Auto-fix was run, but additional issues found. | |
Please review the run log: https://github.com/mdn/content/actions/runs/${{ github.run_id }} | |
labels: | | |
automated pr | |
token: ${{ secrets.AUTOMERGE_TOKEN }} |