Skip to content

fix: github secrets

fix: github secrets #1

Workflow file for this run

---
name: Go CI
on:
workflow_call:
secrets:
github_username:
required: false
github_token:

Check failure on line 9 in .github/workflows/go-ci.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/go-ci.yml

Invalid workflow file

secret name `github_token` within `workflow_call` can not be used since it would collide with system reserved name
required: false
inputs:
go-version:
description: "The version of Go to use"
required: false
type: string
go-build-args:
description: "The arguments to pass to the go build command"
required: false
default: "."
type: string
go-test-args:
description: "The arguments to pass to the go test command"
required: false
default: "-cover -v ./..."
type: string
go-bench-args:
description: "The arguments to pass to the go test command when running benchmarks"
required: false
default: "-bench=./..."
type: string
go-private:
description: "The GOPRIVATE environment variable"
required: false
type: string
run-benchmarks:
description: "Run benchmarks"
required: false
default: true
type: boolean
jobs:
build:
env:
GOPRIVATE: "${{ inputs.go-private }}"
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
if: inputs.go-version != ''
uses: actions/setup-go@v5
with:
go-version: ${{ inputs.go-version }}
- name: Set up Go
if: inputs.go-version == ''
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Setup private repository access
if: inputs.go-private != ''
run: git config --global url."https://${{ secrets.github_username }}:${{ secrets.github_token }}@github.com".insteadOf "https://github.com"
- name: Install dependencies
run: |
go env
go mod download
go mod verify
- name: Build
run: go build ${{ inputs.go-build-args }}
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: latest
args: --timeout=5m --verbose
- name: Run tests
run: go test ${{ inputs.go-test-args }}
- name: Run benchmarks
if: inputs.run-benchmarks
run: go test ${{ inputs.go-bench-args }}