1
0
mirror of synced 2025-12-19 18:10:59 -05:00

Restore content linter workflow (#54896)

This commit is contained in:
Hector Alfaro
2025-03-18 18:33:30 -04:00
committed by GitHub
parent 971ff91db9
commit 3549368fd9

View File

@@ -25,40 +25,37 @@ jobs:
- name: Check out repo - name: Check out repo
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with: with:
# Picking this number is a "best guess". If we make it too large,
# the checkout will take potentially unnecessariily long.
# This reduces the chance that tj-actions/changed-files has to
# fetch deeper history. But if it needs to, it will.
fetch-depth: 10 fetch-depth: 10
- name: Set up Node and dependencies - name: Set up Node and dependencies
uses: ./.github/actions/node-npm-setup uses: ./.github/actions/node-npm-setup
- name: Get changed content/data files - name: Get changed content/data files
id: changed-files id: changed_files
uses: ./.github/actions/get-changed-files uses: ./.github/actions/get-changed-files
with: with:
files: | files: |
content/** content/**
data/** data/**
token: ${{ secrets.GITHUB_TOKEN }}
- name: Print content linter annotations if changed content/data files - name: Print content linter annotations if changed content/data files
if: steps.changed-files.outputs.filtered_changed_files if: steps.changed_files.outputs.filtered_changed_files
env: env:
# Make it an environment variable so that its value doesn't need to be escaped. # Make it an environment variable so that its value doesn't need to be escaped.
# See https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable # See https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable
CHANGED_FILES: |- CHANGED_FILES: |-
${{ steps.changed-files.outputs.filtered_changed_files }} ${{ steps.changed_files.outputs.filtered_changed_files }}
# If there are errors, using `--print-annotations` will make it # If there are errors, using `--print-annotations` will make it
# so it does *not* exit non-zero. # so it does *not* exit non-zero.
# This is so that all warnings and errors are printed. # This is so that all warnings and errors are printed.
run: npm run lint-content -- --print-annotations --paths $CHANGED_FILES run: npm run lint-content -- --print-annotations --paths $CHANGED_FILES
- name: Run content linter if changed content/data files - name: Run content linter if changed content/data files
if: steps.changed-files.outputs.any_changed == 'true' if: steps.changed_files.outputs.any_changed == 'true'
env: env:
# Make it an environment variable so that its value doesn't need to be escaped. # Make it an environment variable so that its value doesn't need to be escaped.
# See https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable # See https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable
CHANGED_FILES: |- CHANGED_FILES: |-
${{ steps.changed-files.outputs.filtered_changed_files }} ${{ steps.changed_files.outputs.filtered_changed_files }}
run: npm run lint-content -- --errors-only --paths $CHANGED_FILES run: npm run lint-content -- --errors-only --paths $CHANGED_FILES