wordpress/.github/workflows/reusable-coding-standards-javascript.yml
Jonathan Desrosiers 015148da1d Build/Test Tools: Avoid using *-latest tags for runner images.
While using the `ubuntu-latest`, `macos-latest`, and `windows-latest` runner image tags is convenient, it has proven to be problematic in a number of instances as the runners are slowly updated (see  and ).

This switches all workflows to using specific version tags representing the latest non-preview versions, which currently are as follows:
- `ubuntu-24.04`
- `windows-2022`
- `macos-14`

Props swissspidy, johnbillion.
See .

git-svn-id: https://develop.svn.wordpress.org/trunk@59720 602fd350-edb4-49c9-b593-d223f7449a82
2025-01-28 14:00:16 +00:00

62 lines
1.6 KiB
YAML

##
# A reusable workflow that checks the JavaScript coding standards.
##
name: JavaScript coding standards
on:
workflow_call:
env:
PUPPETEER_SKIP_DOWNLOAD: ${{ true }}
# Disable permissions for all available scopes by default.
# Any needed permissions should be configured at the job level.
permissions: {}
jobs:
# Runs the JavaScript coding standards checks.
#
# JSHint violations are not currently reported inline with annotations.
#
# Performs the following steps:
# - Checks out the repository.
# - Sets up Node.js.
# - Logs debug information about the GitHub Action runner.
# - Installs npm dependencies.
# - Run the WordPress JSHint checks.
# - Ensures version-controlled files are not modified or deleted.
jshint:
name: Run coding standards checks
runs-on: ubuntu-24.04
permissions:
contents: read
timeout-minutes: 20
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
show-progress: ${{ runner.debug == '1' && 'true' || 'false' }}
persist-credentials: false
- name: Set up Node.js
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0
with:
node-version-file: '.nvmrc'
cache: npm
- name: Log debug information
run: |
npm --version
node --version
git --version
- name: Install npm Dependencies
run: npm ci
- name: Run JSHint
run: npm run grunt jshint
- name: Ensure version-controlled files are not modified or deleted
run: git diff --exit-code