Skip to content

Extend Trigger Capabilities #9613

Extend Trigger Capabilities

Extend Trigger Capabilities #9613

Workflow file for this run

name: golangci-lint
on: [pull_request, merge_group]
jobs:
detect-modules:
runs-on: ubuntu-latest
outputs:
modules: ${{ steps.set-modules.outputs.modules }}
steps:
- uses: actions/checkout@v5
- id: set-modules
run: |
# Find all go.mod files and extract their directories
modules=$(find . -name "go.mod" -not -path "./vendor/*" -exec dirname {} \; | jq -R -s -c 'split("\n") | map(select(. != ""))')
echo "modules=${modules}" >> $GITHUB_OUTPUT
echo "Found modules: ${modules}"
lint-module:
# Avoid running in merge queue since we run in PR's and have an optional
# label to skip lint issues on a PR which would be ignored in the merge queue.
if: ${{ github.event_name != 'merge_group' }}
needs: detect-modules
runs-on: ubuntu-latest
strategy:
matrix:
module: ${{ fromJSON(needs.detect-modules.outputs.modules) }}
permissions:
id-token: write
contents: read
actions: read
pull-requests: read
steps:
- name: Checkout code
uses: actions/checkout@v5
with:
persist-credentials: false
- name: Get golangci-lint version from asdf
id: get-version
run: |
version=$(grep '^golangci-lint ' .tool-versions | awk '{print $2}')
echo "version=${version}" | tee -a "$GITHUB_OUTPUT"
- name: golangci-lint ${{ matrix.module }}
if: ${{ always() && !contains(join(github.event.pull_request.labels.*.name, ' '), 'allow-lint-issues') }}
# NOTE: Keep this version in sync with ACTION_CI_LINT_GO_GIT_TAG in ./script/lint.sh
uses: smartcontractkit/.github/actions/ci-lint-go@ci-lint-go/3.0.0
with:
checkout-repo: false
golangci-lint-version: v${{ steps.get-version.outputs.version }}
go-directory: ${{ matrix.module }}
golangci-lint:
# Required sink job that waits for all lint jobs to complete
if: ${{ github.event_name != 'merge_group' }}
needs: [detect-modules, lint-module]
runs-on: ubuntu-latest
steps:
- name: Lint complete
run: echo "All lint jobs completed"