Create content auto-fix PR #70
This file contains hidden or 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
| # This is a port of the equivalent workflow in mdn/content. | |
| # See https://github.com/mdn/content/blob/main/.github/workflows/auto-cleanup-bot.yml | |
| name: Create content auto-fix PR | |
| on: | |
| schedule: | |
| - cron: "0 0 * * *" | |
| workflow_dispatch: | |
| permissions: {} | |
| jobs: | |
| fix: | |
| if: github.repository == 'mdn/translated-content' | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| lang: | |
| - es | |
| - fr | |
| - ja | |
| - ko | |
| - pt-br | |
| - ru | |
| - zh-cn | |
| - zh-tw | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: false | |
| - name: Checkout (content) | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| repository: mdn/content | |
| path: mdn/content | |
| persist-credentials: false | |
| - name: Setup Node.js environment | |
| uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 | |
| with: | |
| node-version-file: mdn/content/.nvmrc | |
| package-manager-cache: false | |
| - name: Install | |
| run: npm ci | |
| env: | |
| # https://github.com/microsoft/vscode-ripgrep#github-api-limit-note | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Install for mdn/content | |
| working-directory: ${{ github.workspace }}/mdn/content | |
| run: npm ci | |
| env: | |
| # https://github.com/microsoft/vscode-ripgrep#github-api-limit-note | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Fix flaws | |
| env: | |
| CONTENT_ROOT: ${{ github.workspace }}/mdn/content/files | |
| CONTENT_TRANSLATED_ROOT: ${{ github.workspace }}/files | |
| # Used by the `rari` cli to avoid rate limiting issues | |
| # when fetching the latest releases info from the GitHub API. | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| working-directory: ${{ github.workspace }}/mdn/content | |
| run: | | |
| npm run content fix-flaws -- --locale "${{ matrix.lang }}" | |
| - name: Lint Markdown files | |
| run: | | |
| npx markdownlint-cli2 --fix "**/${{ matrix.lang }}/**/*.md" | |
| node ./scripts/check-url-locale.js --fix "files/${{ matrix.lang }}" | |
| ls -d 2>/dev/null "files/${{ matrix.lang }}" "docs/${{ matrix.lang }}" | xargs npx autocorrect --fix | |
| npx prettier -w "**/${{ matrix.lang }}/**/*.md" | |
| cd ${{ github.workspace }}/mdn/content && npm run fix:fm -- --config-file ${{ github.workspace }}/.front-matter-config.json "${{ github.workspace }}/files/${{ matrix.lang }}" | |
| - name: Create PR with only fixable issues | |
| if: success() | |
| uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1 | |
| with: | |
| commit-message: "${{ matrix.lang }}: auto-fix content issues" | |
| branch: content-autofix-${{ matrix.lang }} | |
| title: "[${{ matrix.lang }}] auto-fix content issues" | |
| author: mdn-bot <108879845+mdn-bot@users.noreply.github.com> | |
| committer: mdn-bot <108879845+mdn-bot@users.noreply.github.com> | |
| body: | | |
| This PR was generated by [this run](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) of the [`auto-cleanup-bot`](https://github.com/${{ github.repository }}/blob/${{ github.ref_name }}/.github/workflows/auto-cleanup-bot.yml) workflow. | |
| All issues were 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@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1 | |
| with: | |
| commit-message: "${{ matrix.lang }}: auto-fix content issues" | |
| branch: content-autofix-${{ matrix.lang }} | |
| title: "[${{ matrix.lang }}] auto-fix content issues" | |
| author: mdn-bot <108879845+mdn-bot@users.noreply.github.com> | |
| committer: mdn-bot <108879845+mdn-bot@users.noreply.github.com> | |
| body: | | |
| This PR was generated by the [`auto-cleanup-bot`](https://github.com/${{ github.repository }}/blob/${{ github.ref_name }}/.github/workflows/auto-cleanup-bot.yml) workflow. | |
| Auto-fix was run, but additional issues found. | |
| Please review the [run log](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}). | |
| labels: | | |
| automated pr | |
| token: ${{ secrets.AUTOMERGE_TOKEN }} |