Bump prettier from 3.4.1 to 3.4.2 #356
Workflow file for this run
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
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/check-toc-task.md | |
name: Check ToC | |
env: | |
# See: https://github.com/actions/setup-node/#readme | |
NODE_VERSION: 16.x | |
# See: https://docs.github.com/actions/using-workflows/events-that-trigger-workflows | |
on: | |
create: | |
push: | |
paths: | |
- ".github/workflows/check-toc-task.ya?ml" | |
- "package.json" | |
- "package-lock.json" | |
- "Taskfile.ya?ml" | |
- "content/categories/staff/moderation/_topics/moderator-instructions/1.md" | |
pull_request: | |
paths: | |
- ".github/workflows/check-toc-task.ya?ml" | |
- "package.json" | |
- "package-lock.json" | |
- "Taskfile.ya?ml" | |
- "content/categories/staff/moderation/_topics/moderator-instructions/1.md" | |
schedule: | |
# Run periodically to catch breakage caused by external changes. | |
- cron: "0 3 * * WED" | |
workflow_dispatch: | |
repository_dispatch: | |
jobs: | |
run-determination: | |
runs-on: ubuntu-latest | |
outputs: | |
result: ${{ steps.determination.outputs.result }} | |
steps: | |
- name: Determine if the rest of the workflow should run | |
id: determination | |
run: | | |
RELEASE_BRANCH_REGEX="refs/heads/[0-9]+.[0-9]+.x" | |
# The `create` event trigger doesn't support `branches` filters, so it's necessary to use Bash instead. | |
if [[ | |
"${{ github.event_name }}" != "create" || | |
"${{ github.ref }}" =~ $RELEASE_BRANCH_REGEX | |
]]; then | |
# Run the other jobs. | |
RESULT="true" | |
else | |
# There is no need to run the other jobs. | |
RESULT="false" | |
fi | |
echo "result=$RESULT" >> $GITHUB_OUTPUT | |
check: | |
name: ${{ matrix.file.name }} | |
needs: run-determination | |
if: needs.run-determination.outputs.result == 'true' | |
runs-on: ubuntu-latest | |
env: | |
ARTIFACT_NAME: corrected-files | |
strategy: | |
fail-fast: false | |
matrix: | |
file: | |
- name: content/categories/staff/moderation/_topics/moderator-instructions/1.md | |
maxdepth: 4 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- name: Install Task | |
uses: arduino/setup-task@v2 | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
version: 3.x | |
- name: Rebuild ToC | |
run: | | |
task markdown:toc \ | |
FILE_PATH="${{ github.workspace }}/${{ matrix.file.name }}" \ | |
MAX_DEPTH=${{ matrix.file.maxdepth }} | |
- name: Check ToC | |
id: check-toc | |
run: git diff --color --exit-code | |
- name: Upload corrected file to workflow artifact | |
if: failure() && steps.check-toc.outcome == 'failure' | |
uses: actions/upload-artifact@v4 | |
with: | |
if-no-files-found: error | |
name: ${{ env.ARTIFACT_NAME }} | |
# Globstar prefix is to preserve folder structure in artifact. | |
# https://github.com/actions/upload-artifact/tree/v3.1.2#:~:text=path%20hierarchy%20will%20be%20preserved | |
path: "**/${{ matrix.file.name }}" | |
- name: Add artifact availability notice | |
if: failure() && steps.check-toc.outcome == 'failure' | |
run: | | |
echo "::notice file=${{ matrix.file.name }}::Corrected file was saved to the ${{ env.ARTIFACT_NAME }} workflow artifact" | |
- name: Resolution instructions | |
if: failure() && steps.check-toc.outcome == 'failure' | |
run: | | |
echo "Table of contents can be updated by running the following command from the root of the repository:" | |
echo "task markdown:toc FILE_PATH=${{ matrix.file.name }} MAX_DEPTH=${{ matrix.file.maxdepth }}" | |
echo | |
echo "- OR -" | |
echo | |
echo "Download the ${{ env.ARTIFACT_NAME }} workflow artifact and replace ${{ matrix.file.name }} with the" | |
echo "corrected file from the artifact." | |
echo "See: https://docs.github.com/actions/managing-workflow-runs/downloading-workflow-artifacts" |