diff --git a/.github/workflows/linters.yml b/.github/workflows/linters.yml index b3db61eca640f7..8e0d63277cbf6c 100644 --- a/.github/workflows/linters.yml +++ b/.github/workflows/linters.yml @@ -21,7 +21,7 @@ permissions: contents: read jobs: - lint-addon-docs: + lint-node-based: if: github.event.pull_request.draft == false runs-on: ubuntu-latest steps: @@ -36,7 +36,22 @@ jobs: run: npx envinfo - name: Lint addon docs run: NODE=$(command -v node) make lint-addon-docs - lint-cpp: + - 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 >> $GITHUB_OUTPUT + - 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 }} + - run: shellcheck -V + - name: Lint Shell scripts + run: tools/lint-sh.mjs . + lint-python-based: if: github.event.pull_request.draft == false runs-on: ubuntu-latest steps: @@ -51,6 +66,14 @@ jobs: run: npx envinfo - name: Lint C/C++ files run: make lint-cpp + - name: Lint Python + run: | + make lint-py-build + make lint-py + - name: Lint YAML + run: | + make lint-yaml-build || true + make lint-yaml format-cpp: if: ${{ github.event.pull_request && github.event.pull_request.draft == false && github.base_ref == github.event.repository.default_branch }} runs-on: ubuntu-latest @@ -89,102 +112,23 @@ jobs: echo 'to format the commits in your branch.' exit "$EXIT_CODE" fi - lint-js-and-md: - if: github.event.pull_request.draft == false - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - with: - persist-credentials: false - - name: Use Node.js ${{ env.NODE_VERSION }} - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 - with: - node-version: ${{ env.NODE_VERSION }} - - name: Environment Information - 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 >> $GITHUB_OUTPUT - - 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 - steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - with: - persist-credentials: false - - name: Set up Python ${{ env.PYTHON_VERSION }} - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 - with: - python-version: ${{ env.PYTHON_VERSION }} - - name: Environment Information - run: npx envinfo - - name: Lint Python - run: | - make lint-py-build - make lint-py - lint-yaml: - if: github.event.pull_request.draft == false + lint-misc: runs-on: ubuntu-latest steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: + fetch-depth: 2 persist-credentials: false - - name: Use Python ${{ env.PYTHON_VERSION }} - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 - with: - python-version: ${{ env.PYTHON_VERSION }} - name: Environment Information run: npx envinfo - - name: Lint YAML - run: | - make lint-yaml-build || true - make lint-yaml - - lint-sh: - if: github.event.pull_request.draft == false - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - with: - persist-credentials: false - - run: shellcheck -V - - name: Lint Shell scripts - run: tools/lint-sh.mjs . - lint-codeowners: - if: github.event.pull_request.draft == false - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - with: - persist-credentials: false - - uses: mszostok/codeowners-validator@7f3f5e28c6d7b8dfae5731e54ce2272ca384592f + - name: Lint CODEOWNERS + if: github.event.pull_request.draft == false + uses: mszostok/codeowners-validator@7f3f5e28c6d7b8dfae5731e54ce2272ca384592f with: checks: files,duppatterns - lint-pr-url: - if: ${{ github.event.pull_request }} - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - with: - fetch-depth: 2 - persist-credentials: false - # GH Actions squashes all PR commits, HEAD^ refers to the base branch. - - run: git diff HEAD^ HEAD -G"pr-url:" -- "*.md" | ./tools/lint-pr-url.mjs ${{ github.event.pull_request.html_url }} - lint-readme: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - with: - persist-credentials: false + - name: Lint PR URLs + if: ${{ github.event.pull_request }} + run: git diff HEAD^ HEAD -G"pr-url:" -- "*.md" | ./tools/lint-pr-url.mjs ${{ github.event.pull_request.html_url }} - name: Get team members if possible if: ${{ (github.event.pull_request && github.event.pull_request.base.ref == github.event.pull_request.base.repo.default_branch) || github.event.ref == github.event.repository.default_branch }} id: team_members @@ -201,6 +145,7 @@ jobs: ) >> "$GITHUB_OUTPUT" env: GITHUB_TOKEN: ${{ secrets.GH_USER_TOKEN }} - - run: tools/lint-readme-lists.mjs "$TEAMS" + - name: Lint README + run: tools/lint-readme-lists.mjs "$TEAMS" env: TEAMS: ${{ tojson(steps.team_members.outputs) }}