ci: 💚 refactor GHA lint tools (#2421)

This commit is contained in:
Eric Nemchik
2025-07-16 00:44:56 -05:00
committed by GitHub
parent f14be0378b
commit ae96e42d46
18 changed files with 88 additions and 116 deletions

View File

@@ -1,13 +0,0 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: weekly
open-pull-requests-limit: 10
- package-ecosystem: pip
directory: "/"
schedule:
interval: weekly
open-pull-requests-limit: 10

16
.github/renovate.json vendored Normal file
View File

@@ -0,0 +1,16 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:best-practices",
"customManagers:githubActionsVersions",
":automergeBranch",
":automergeDigest",
":automergeLinters",
":automergeStableNonMajor",
":automergeTesters",
":automergeTypes",
":enableVulnerabilityAlerts",
":renovatePrefix"
],
"baseBranches": ["$default"]
}

View File

@@ -13,8 +13,8 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout repository - name: Checkout
uses: actions/checkout@v4.1.6 uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with: with:
fetch-depth: 0 fetch-depth: 0
token: ${{ secrets.PAT }} token: ${{ secrets.PAT }}

View File

@@ -2,8 +2,6 @@ name: Label Conflicts
on: on:
push: push:
branches:
- master
pull_request: pull_request:
jobs: jobs:
@@ -12,7 +10,9 @@ jobs:
permissions: permissions:
pull-requests: write pull-requests: write
steps: steps:
- uses: mschilde/auto-label-merge-conflicts@master - name: Label merge conflicts
uses: mschilde/auto-label-merge-conflicts@v2.0
if: github.event.repository.fork == false
with: with:
CONFLICT_LABEL_NAME: "Status: Conflicted" CONFLICT_LABEL_NAME: "Status: Conflicted"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -2,8 +2,6 @@ name: Validate Custom Format JSONs
on: on:
push: push:
branches:
- master
paths: paths:
- .github/workflows/custom-format-validation.yml - .github/workflows/custom-format-validation.yml
- docs/json/guide-only/*.json - docs/json/guide-only/*.json
@@ -23,10 +21,10 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout repository - name: Checkout
uses: actions/checkout@v4.1.5 uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Setup Python - name: Setup python
uses: actions/setup-python@v5.6.0 uses: actions/setup-python@v5.6.0
with: with:
python-version: "3.x" python-version: "3.x"

View File

@@ -25,8 +25,8 @@ jobs:
pr_number: ${{ steps.pr_info.outputs.pr_number }} pr_number: ${{ steps.pr_info.outputs.pr_number }}
pr_sha: ${{ steps.pr_info.outputs.pr_sha }} pr_sha: ${{ steps.pr_info.outputs.pr_sha }}
steps: steps:
- name: 'Download artifact' - name: Download artifact
uses: actions/download-artifact@v4 uses: actions/download-artifact@v4.3.0
with: with:
run-id: ${{ github.event.workflow_run.id }} run-id: ${{ github.event.workflow_run.id }}
github-token: ${{ github.token }} github-token: ${{ github.token }}
@@ -42,8 +42,8 @@ jobs:
echo "pr_number=$(cat ${{ github.workspace }}/pr_info/PR_NUMBER)" >> $GITHUB_OUTPUT echo "pr_number=$(cat ${{ github.workspace }}/pr_info/PR_NUMBER)" >> $GITHUB_OUTPUT
echo "pr_sha=$(cat ${{ github.workspace }}/pr_info/PR_SHA)" >> $GITHUB_OUTPUT echo "pr_sha=$(cat ${{ github.workspace }}/pr_info/PR_SHA)" >> $GITHUB_OUTPUT
- name: Checkout repo - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with: with:
ref: ${{ steps.pr_info.outputs.pr_sha }} ref: ${{ steps.pr_info.outputs.pr_sha }}
fetch-depth: 0 fetch-depth: 0
@@ -81,7 +81,7 @@ jobs:
- name: Publish to Cloudflare Pages - name: Publish to Cloudflare Pages
id: cloudflare id: cloudflare
uses: cloudflare/wrangler-action@v3 uses: cloudflare/wrangler-action@v3.1.0
with: with:
apiToken: ${{ secrets.CF_API_TOKEN }} apiToken: ${{ secrets.CF_API_TOKEN }}
accountId: ${{ secrets.CF_ACCOUNT_ID }} accountId: ${{ secrets.CF_ACCOUNT_ID }}
@@ -96,8 +96,8 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: always() && github.event.repository.fork == false if: always() && github.event.repository.fork == false
steps: steps:
- name: Checkout repo - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Comment PR - name: Comment PR
run: | run: |

View File

@@ -2,8 +2,6 @@ name: Build and Deploy Docs
on: on:
push: push:
branches:
- master
jobs: jobs:
build: build:
@@ -13,8 +11,8 @@ jobs:
group: ${{ github.workflow }}-${{ github.ref }} group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true cancel-in-progress: true
steps: steps:
- name: Checkout repository - name: Checkout
uses: actions/checkout@v4.1.6 uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with: with:
fetch-depth: 0 fetch-depth: 0
sparse-checkout: | sparse-checkout: |
@@ -50,14 +48,14 @@ jobs:
mkdocs --version mkdocs --version
- name: Publish to Cloudflare Pages - name: Publish to Cloudflare Pages
if: github.event_name == 'push' && contains(fromJson('["refs/heads/master", "refs/heads/main"]'), github.ref) if: github.event_name == 'push' && github.event.repository.fork == false
id: cloudflare id: cloudflare
uses: cloudflare/wrangler-action@v3 uses: cloudflare/wrangler-action@v3.1.0
with: with:
apiToken: ${{ secrets.CF_API_TOKEN }} apiToken: ${{ secrets.CF_API_TOKEN }}
accountId: ${{ secrets.CF_ACCOUNT_ID }} accountId: ${{ secrets.CF_ACCOUNT_ID }}
command: > command: >
pages deploy site pages deploy site
--project-name=trash-guides --project-name=trash-guides
--branch=master --branch=${{ github.ref_name }}
--commit-hash=${{ github.sha }} --commit-hash=${{ github.sha }}

View File

@@ -2,8 +2,6 @@ name: Label Pull Requests
on: on:
push: push:
branches:
- master
pull_request_target: pull_request_target:
jobs: jobs:
@@ -13,6 +11,7 @@ jobs:
pull-requests: write pull-requests: write
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/labeler@v5 - name: Labeler
uses: actions/labeler@v5.0.0
with: with:
sync-labels: true sync-labels: true

View File

@@ -1,18 +0,0 @@
name: Lint - EditorConfig
on:
push:
branches:
- master
pull_request:
jobs:
editorconfig-checker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.1.6
- name: editorconfig-checker
run: |
docker run --rm \
-v "${GITHUB_WORKSPACE}":/check \
mstruebing/editorconfig-checker

View File

@@ -1,21 +0,0 @@
name: Lint - Markdown
on:
push:
branches:
- master
pull_request:
jobs:
markdownlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.1.6
- name: markdownlint
# markdownlint-cli pinned to v0.45.0
run: |
docker run --rm \
-v "${GITHUB_WORKSPACE}":/workdir \
ghcr.io/igorshubovych/markdownlint-cli@sha256:27eadb7b23b79b4b01b9220e18467d041804e632f41cf69b9c1613b48ed72749 \
-c "/workdir/.markdownlint.yaml" \
.

View File

@@ -1,23 +0,0 @@
name: Lint - YAML
on:
push:
branches:
- master
pull_request:
jobs:
yamllint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.1.6
- name: Run yamllint
run: |
docker run --rm \
-v "${GITHUB_WORKSPACE}":/yaml \
peterdavehello/yamllint \
yamllint \
-c "/yaml/yamllint.yml" \
.

39
.github/workflows/lint.yml vendored Normal file
View File

@@ -0,0 +1,39 @@
name: Lint
on:
push:
pull_request:
jobs:
editorconfig-checker:
runs-on: ubuntu-latest
container:
image: mstruebing/editorconfig-checker:v3.3.0@sha256:a04d1bf7c8c7e01534e11ce9253d66721d7b039722ce514910c59bb68ce14f50
options: --user 0:0
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: editorconfig-checker
run: editorconfig-checker .
markdownlint:
runs-on: ubuntu-latest
container:
image: davidanson/markdownlint-cli2:v0.18.1@sha256:173cb697a255a8a985f2c6a83b4f7a8b3c98f4fb382c71c45f1c52e4d4fed63a
options: --user 0:0
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: markdownlint
run: markdownlint-cli2 **.{md,markdown}
yamllint:
runs-on: ubuntu-latest
container:
image: peterdavehello/yamllint:1.37.0@sha256:bb8e9a2970f31503714447e2c309add8eb27ad57a66dee6fa2d37322415ed0ae
options: --user 0:0
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: yamllint
run: yamllint .

View File

@@ -2,8 +2,6 @@ name: Validate Metadata JSON
on: on:
push: push:
branches:
- master
paths: paths:
- metadata.json - metadata.json
- metadata.schema.json - metadata.schema.json
@@ -19,8 +17,10 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
name: Validate metadata.json name: Validate metadata.json
steps: steps:
- uses: actions/checkout@v4.1.6 - name: Checkout
- uses: actions/setup-python@v5.6.0 uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Setup python
uses: actions/setup-python@v5.6.0
with: with:
python-version: 3.x python-version: 3.x
- run: pip install jsonschema - run: pip install jsonschema

View File

@@ -2,8 +2,6 @@ name: Check for Mkdocs Issues
on: on:
push: push:
branches:
- master
pull_request: pull_request:
jobs: jobs:
@@ -13,8 +11,8 @@ jobs:
pull-requests: write pull-requests: write
steps: steps:
- name: Checkout Code - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Find JSON Files Changed in Commit - name: Find JSON Files Changed in Commit
id: find_json_files id: find_json_files

View File

@@ -15,7 +15,7 @@ jobs:
steps: steps:
- name: Validate Pull Request Title - name: Validate Pull Request Title
id: check_title id: check_title
uses: actions/github-script@v7 uses: actions/github-script@v7.0.1
with: with:
github-token: ${{ secrets.GITHUB_TOKEN }} github-token: ${{ secrets.GITHUB_TOKEN }}
script: | script: |

View File

@@ -22,7 +22,8 @@ jobs:
echo ${{ github.event.pull_request.number }} > ./pr_info/PR_NUMBER echo ${{ github.event.pull_request.number }} > ./pr_info/PR_NUMBER
echo ${{ github.event.pull_request.head.sha }} > ./pr_info/PR_SHA echo ${{ github.event.pull_request.head.sha }} > ./pr_info/PR_SHA
- uses: actions/upload-artifact@v4 - name: Upload PR info
uses: actions/upload-artifact@v4.6.2
with: with:
name: pr_info name: pr_info
path: pr_info/ path: pr_info/

View File

@@ -2,8 +2,6 @@ name: Update contributors
on: on:
push: push:
branches:
- master
permissions: permissions:
contents: write contents: write
@@ -14,12 +12,12 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with: with:
token: ${{ secrets.PAT }} token: ${{ secrets.PAT }}
- name: Install Node.js - name: Install Node.js
uses: actions/setup-node@v4 uses: actions/setup-node@v4.4.0
with: with:
node-version: "20" node-version: "20"