Skip to content

feat(run-policy): add allowed runs-on mode, harden-runner checks, and secrets default-branch attributes #192

feat(run-policy): add allowed runs-on mode, harden-runner checks, and secrets default-branch attributes

feat(run-policy): add allowed runs-on mode, harden-runner checks, and secrets default-branch attributes #192

Workflow file for this run

name: Go checks and Test
on:
pull_request:
branches:
- main
permissions:
contents: read
jobs:
go-ci:
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@4d991eb9b905ef189e4c376166672c3f2f230481
with:
egress-policy: audit
- name: Checkout code
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
with:
go-version-file: 'go.mod'
- name: Build
run: go build -v ./...
- name: Vet
run: go vet ./...
- name: Run golangci-lint
uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9
with:
only-new-issues: true
args: --issues-exit-code=0
test:
runs-on: ubuntu-latest
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@4d991eb9b905ef189e4c376166672c3f2f230481 # v2.11.0
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
with:
go-version-file: 'go.mod'
- name: Run go tests
run: go test -race ./...
docs-check:
name: Check Documentation
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@4d991eb9b905ef189e4c376166672c3f2f230481
with:
egress-policy: audit
- name: Checkout code
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5
with:
go-version-file: 'go.mod'
- name: Setup Terraform
uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2
with:
terraform_version: "1.5.7"
terraform_wrapper: false
- name: Generate documentation
run: go generate -tags tools tools/tools.go
- name: Check for documentation changes
run: |
if [[ -n "$(git diff --name-only docs/)" ]]; then
echo "::error::Documentation is out of sync with examples. Please run 'make docs' locally and commit the changes."
git diff --name-only docs/
exit 1
else
echo "Documentation is up-to-date with examples."
fi