From 46bc3c1af19f1e5d57a3ce6ad5e69a77ecd7bfc2 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Sun, 3 Apr 2022 16:47:02 -0700 Subject: [PATCH] build: consolidate JS and md linting GitHub Actions Linting markdown runs the JavaScript linting job, so consolidate them to conserve time and resources. Run JavaScript separately, but then run markdown linting so it can use the cached results of the JavaScript linting. PR-URL: https://github.com/nodejs/node/pull/42572 Reviewed-By: Antoine du Hamel Reviewed-By: Luigi Pinca Reviewed-By: Mestery Reviewed-By: James M Snell Reviewed-By: Darshan Sen --- .github/workflows/linters.yml | 36 +++++++++++------------------------ 1 file changed, 11 insertions(+), 25 deletions(-) diff --git a/.github/workflows/linters.yml b/.github/workflows/linters.yml index 6eed7015e58..e5eff5ee447 100644 --- a/.github/workflows/linters.yml +++ b/.github/workflows/linters.yml @@ -49,31 +49,7 @@ jobs: run: npx envinfo - name: Lint C/C++ files run: make lint-cpp - lint-md: - if: github.event.pull_request.draft == false - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - persist-credentials: false - - name: Use Node.js ${{ env.NODE_VERSION }} - uses: actions/setup-node@v3 - with: - node-version: ${{ env.NODE_VERSION }} - - name: Environment Information - run: npx envinfo - - name: Get release version numbers - if: ${{ github.event.pull_request && github.event.pull_request.base.ref == github.event.pull_request.base.repo.default_branch }} - id: get-released-versions - run: ./tools/lint-md/list-released-versions-from-changelogs.mjs - - name: Lint docs - run: | - echo "::add-matcher::.github/workflows/remark-lint-problem-matcher.json" - NODE=$(command -v node) make lint-md - env: - NODE_RELEASED_VERSIONS: ${{ steps.get-released-versions.outputs.NODE_RELEASED_VERSIONS }} - - lint-js: + lint-js-and-md: if: github.event.pull_request.draft == false runs-on: ubuntu-latest steps: @@ -88,6 +64,16 @@ jobs: run: npx envinfo - name: Lint JavaScript files run: NODE=$(command -v node) make lint-js + - name: Get release version numbers + if: ${{ github.event.pull_request && github.event.pull_request.base.ref == github.event.pull_request.base.repo.default_branch }} + id: get-released-versions + run: ./tools/lint-md/list-released-versions-from-changelogs.mjs + - name: Lint markdown files + run: | + echo "::add-matcher::.github/workflows/remark-lint-problem-matcher.json" + NODE=$(command -v node) make lint-md + env: + NODE_RELEASED_VERSIONS: ${{ steps.get-released-versions.outputs.NODE_RELEASED_VERSIONS }} lint-py: if: github.event.pull_request.draft == false runs-on: ubuntu-latest