|
7 | 7 | pull_request: {} |
8 | 8 |
|
9 | 9 | jobs: |
10 | | - go: |
11 | | - uses: mirceanton/reusable-workflows/.github/workflows/reusable-go-lint.yaml@feat/custom-images |
12 | | - secrets: inherit |
13 | | - with: |
14 | | - # renovate: depName=golangci/golangci-lint datasource=github-tags |
15 | | - version: v2.1.2 |
16 | | - |
17 | | - bash: |
18 | | - uses: mirceanton/reusable-workflows/.github/workflows/reusable-shellcheck.yaml@09f31ab6340ce5651dc6c28512a82de6b2415fb9 # v3.8.2 |
19 | | - secrets: inherit |
20 | | - commits: |
21 | | - uses: mirceanton/reusable-workflows/.github/workflows/reusable-commitlint.yaml@09f31ab6340ce5651dc6c28512a82de6b2415fb9 # v3.8.2 |
22 | | - secrets: inherit |
23 | | - with: { config-file: ./.github/configs/commitlint.config.mjs } |
24 | | - github-actions: |
25 | | - uses: mirceanton/reusable-workflows/.github/workflows/reusable-actionlint.yaml@09f31ab6340ce5651dc6c28512a82de6b2415fb9 # v3.8.2 |
26 | | - secrets: inherit |
27 | | - markdown: |
28 | | - uses: mirceanton/reusable-workflows/.github/workflows/reusable-markdownlint.yaml@09f31ab6340ce5651dc6c28512a82de6b2415fb9 # v3.8.2 |
29 | | - secrets: inherit |
30 | | - with: { config-file: .github/configs/.markdownlint.yaml } |
31 | | - yaml: |
32 | | - uses: mirceanton/reusable-workflows/.github/workflows/reusable-yamllint.yaml@09f31ab6340ce5651dc6c28512a82de6b2415fb9 # v3.8.2 |
33 | | - secrets: inherit |
34 | | - with: { config-file: .github/configs/yamllint.yaml } |
| 10 | + golangci-lint: |
| 11 | + runs-on: ubuntu-latest |
| 12 | + steps: |
| 13 | + - name: Checkout |
| 14 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 15 | + |
| 16 | + - name: Get changed files |
| 17 | + id: changed-files |
| 18 | + uses: bjw-s-labs/action-changed-files@b1144fc772fca235a50902c7bb6cc431cc7d8e27 # v0.3.2 |
| 19 | + with: |
| 20 | + patterns: |- |
| 21 | + .github/workflows/golangci-lint.yaml |
| 22 | + .golangci.yaml |
| 23 | + "**.go" |
| 24 | +
|
| 25 | + - name: Generate Token |
| 26 | + if: steps.changed-files.outputs.changed_files != '[]' |
| 27 | + uses: actions/create-github-app-token@3ff1caaa28b64c9cc276ce0a02e2ff584f3900c5 # v2.0.2 |
| 28 | + id: app-token |
| 29 | + with: |
| 30 | + app-id: "${{ secrets.BOT_APP_ID }}" |
| 31 | + private-key: "${{ secrets.BOT_APP_PRIVATE_KEY }}" |
| 32 | + |
| 33 | + - name: Setup Go |
| 34 | + if: steps.changed-files.outputs.changed_files != '[]' |
| 35 | + uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0 |
| 36 | + with: |
| 37 | + go-version-file: go.mod |
| 38 | + |
| 39 | + - name: Run golangci-lint |
| 40 | + if: steps.changed-files.outputs.changed_files != '[]' |
| 41 | + uses: golangci/golangci-lint-action@1481404843c368bc19ca9406f87d6e0fc97bdcfd # v7.0.0 |
| 42 | + with: |
| 43 | + github-token: "${{ steps.app-token.outputs.token }}" |
| 44 | + # renovate: datasource=github-tags packageName=golangci/golangci-lint |
| 45 | + version: v2.1.2 |
| 46 | + |
| 47 | + # =============================================================================================== |
| 48 | + # "Meta" linters |
| 49 | + # =============================================================================================== |
| 50 | + actionlint: |
| 51 | + runs-on: ubuntu-latest |
| 52 | + container: ghcr.io/mirceanton/gha-runner-actionlint:latest |
| 53 | + steps: |
| 54 | + - name: Checkout |
| 55 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 56 | + |
| 57 | + - name: Get changed files |
| 58 | + id: changed-files |
| 59 | + uses: bjw-s-labs/action-changed-files@b1144fc772fca235a50902c7bb6cc431cc7d8e27 # v0.3.2 |
| 60 | + with: |
| 61 | + patterns: |- |
| 62 | + .github/workflows/**/*.yml |
| 63 | + .github/workflows/**/*.yaml |
| 64 | +
|
| 65 | + - name: Run actionlint |
| 66 | + if: steps.changed-files.outputs.changed_files != '[]' |
| 67 | + run: actionlint |
| 68 | + |
| 69 | + commitlint: |
| 70 | + runs-on: ubuntu-latest |
| 71 | + container: ghcr.io/mirceanton/gha-runner-commitlint:latest |
| 72 | + if: github.event_name == 'pull_request' |
| 73 | + steps: |
| 74 | + - name: Checkout repository |
| 75 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 76 | + |
| 77 | + - name: Validate PR commits with CommitLint |
| 78 | + run: echo "$PR_TITLE" | npx commitlint --extends=./.github/configs/commitlint.config.mjs |
| 79 | + env: |
| 80 | + PR_TITLE: ${{ github.event.pull_request.title }} |
| 81 | + |
| 82 | + markdownlint: |
| 83 | + runs-on: ubuntu-latest |
| 84 | + container: ghcr.io/mirceanton/gha-runner-markdownlint:latest |
| 85 | + steps: |
| 86 | + - name: Checkout repository |
| 87 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 88 | + |
| 89 | + - name: Get changed files |
| 90 | + id: changed-files |
| 91 | + uses: bjw-s-labs/action-changed-files@b1144fc772fca235a50902c7bb6cc431cc7d8e27 # v0.3.2 |
| 92 | + with: |
| 93 | + patterns: |- |
| 94 | + .github/configs/.markdownlint.yaml |
| 95 | + **/*.md |
| 96 | +
|
| 97 | + - name: Run MarkdownLint |
| 98 | + if: steps.changed-files.outputs.changed_files != '[]' |
| 99 | + run: markdownlint --config=.github/configs/.markdownlint.yaml "**/*.md" |
| 100 | + |
| 101 | + yamllint: |
| 102 | + runs-on: ubuntu-latest |
| 103 | + container: ghcr.io/mirceanton/gha-runner-yamllint:latest |
| 104 | + steps: |
| 105 | + - name: Checkout |
| 106 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 107 | + |
| 108 | + - name: Get changed files |
| 109 | + id: changed-files |
| 110 | + uses: bjw-s-labs/action-changed-files@b1144fc772fca235a50902c7bb6cc431cc7d8e27 # v0.3.2 |
| 111 | + with: |
| 112 | + patterns: |- |
| 113 | + **/*.yml |
| 114 | + **/*.yaml |
| 115 | +
|
| 116 | + - name: Run yamllint |
| 117 | + if: steps.changed-files.outputs.changed_files != '[]' |
| 118 | + run: yamllint --config-file=.github/configs/yamllint.yaml . |
0 commit comments