Skip to content

feat: Nautobot operator #304

feat: Nautobot operator

feat: Nautobot operator #304

Workflow file for this run

name: golangci-lint
on:
push:
branches:
- main
paths:
- "go/**"
- .github/workflows/go-lint.yaml
pull_request:
paths:
- "go/**"
- .github/workflows/go-lint.yaml
workflow_dispatch:
merge_group:
types: [checks_requested]
paths:
- "go/**"
- .github/workflows/go-lint.yaml
permissions:
contents: read
# Optional: allow read access to pull request. Use with `only-new-issues` option.
# pull-requests: read
env:
GO_VERSION: 1.23
GOLANGCI_LINT_VERSION: v2.1.2
jobs:
# Initial Setup Job
setup:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
# List directories and set as output
- name: List Applications
id: list_dirs
run: |
apps=$(ls -d go/* | xargs -n1 basename)
app_array=$(printf '%s\n' $apps | jq -R . | jq -cs .)
echo "apps=${app_array}"
printf "apps=%s\n" "${app_array}" >> "$GITHUB_OUTPUT"
shell: bash
# Set up Go environment
- uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6
with:
go-version: ${{ env.GO_VERSION }}
outputs:
apps: ${{ steps.list_dirs.outputs.apps }}
golangci-lint:
runs-on: ubuntu-latest
needs: setup
strategy:
matrix:
app: ${{ fromJson(needs.setup.outputs.apps) }}
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
with:
fetch-depth: 1
- name: golangci-lint ${{ matrix.app }}
uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9 # v8
with:
version: ${{ env.GOLANGCI_LINT_VERSION }}
working-directory: go/${{ matrix.app }}