Skip to content

Commit e3cba64

Browse files
jongioCopilot
andcommitted
feat: dispatch-parity quality improvements
- Pin all GitHub Actions to full commit SHAs - Add CODEOWNERS file - Add Dependabot for go modules and github-actions - Add concurrency control to CI/PR workflows - Add CodeQL security scanning workflow - Add govulncheck vulnerability scanning workflow - Standardize golangci-lint config with 30+ linters - Add dispatch-level linters (errname, exhaustive, forcetypeassert, etc.) - Add gofumpt strict formatting checks - Add deadcode detection - Add cosign code signing to release workflow - Add SBOM generation (SPDX + CycloneDX) to release workflow - Add comprehensive README badges (CI, CodeQL, Go Report Card, etc.) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 9c63ff5 commit e3cba64

30 files changed

+443
-103
lines changed

.github/CODEOWNERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Default code owners for all files
2+
* @jongio

.github/dependabot.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "gomod"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"
7+
commit-message:
8+
prefix: "deps"
9+
- package-ecosystem: "github-actions"
10+
directory: "/"
11+
schedule:
12+
interval: "weekly"
13+
commit-message:
14+
prefix: "ci"

.github/workflows/ci.yml

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
workflow_dispatch:
77

88
concurrency:
9-
group: "ci-${{ github.ref }}"
9+
group: ${{ github.workflow }}-${{ github.ref }}
1010
cancel-in-progress: true
1111

1212
defaults:
@@ -24,17 +24,17 @@ jobs:
2424

2525
steps:
2626
- name: Checkout code
27-
uses: actions/checkout@v4
27+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
2828

2929
- name: Set up Go
30-
uses: actions/setup-go@v5
30+
uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5
3131
with:
3232
go-version: '${{ env.GO_VERSION }}'
3333
cache: true
3434
cache-dependency-path: cli/go.sum
3535

3636
- name: Cache Go tools
37-
uses: actions/cache@v4
37+
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4
3838
with:
3939
path: ~/go/bin
4040
key: go-tools-${{ runner.os }}-${{ hashFiles('cli/go.sum') }}
@@ -80,10 +80,10 @@ jobs:
8080

8181
steps:
8282
- name: Checkout code
83-
uses: actions/checkout@v4
83+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
8484

8585
- name: Set up Go
86-
uses: actions/setup-go@v5
86+
uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5
8787
with:
8888
go-version: '${{ env.GO_VERSION }}'
8989
cache: true
@@ -101,7 +101,7 @@ jobs:
101101
102102
- name: Upload coverage to Codecov
103103
if: github.repository == 'jongio/azd-copilot'
104-
uses: codecov/codecov-action@v4
104+
uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 # v4
105105
with:
106106
file: coverage/coverage.out
107107
flags: unittests
@@ -121,18 +121,8 @@ jobs:
121121
COVERAGE=$(go tool cover -func=../coverage/coverage.out | grep total | awk '{print $3}')
122122
echo "**Total Coverage: $COVERAGE**" >> $GITHUB_STEP_SUMMARY
123123
124-
build:
125-
name: Build
126-
runs-on: ubuntu-latest
127-
needs: [preflight, test]
128-
timeout-minutes: 30
129-
130-
steps:
131-
- name: Checkout code
132-
uses: actions/checkout@v4
133-
134124
- name: Set up Go
135-
uses: actions/setup-go@v5
125+
uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5
136126
with:
137127
go-version: '${{ env.GO_VERSION }}'
138128
cache: true
@@ -146,7 +136,7 @@ jobs:
146136
GOOS=darwin GOARCH=arm64 go build -o bin/darwin-arm64/copilot ./src/cmd/copilot
147137
148138
- name: Upload artifacts
149-
uses: actions/upload-artifact@v4
139+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
150140
with:
151141
name: binaries
152142
path: cli/bin/

.github/workflows/codeql.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: CodeQL
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
schedule:
9+
- cron: '0 0 * * 0' # Weekly on Sundays at midnight UTC
10+
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.ref }}
13+
cancel-in-progress: true
14+
15+
permissions:
16+
contents: read
17+
security-events: write
18+
actions: read
19+
20+
jobs:
21+
analyze:
22+
name: Analyze
23+
runs-on: ubuntu-latest
24+
permissions:
25+
contents: read
26+
security-events: write
27+
actions: read
28+
29+
steps:
30+
- name: Checkout code
31+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
32+
33+
- name: Set up Go
34+
uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6
35+
with:
36+
go-version: '1.26.0'
37+
cache: true
38+
39+
- name: Initialize CodeQL
40+
uses: github/codeql-action/init@dd677812177e0c29f9c970a6c58d8607ae1bfefd # v4
41+
with:
42+
languages: go
43+
44+
- name: Autobuild
45+
uses: github/codeql-action/autobuild@dd677812177e0c29f9c970a6c58d8607ae1bfefd # v4
46+
47+
- name: Perform CodeQL Analysis
48+
uses: github/codeql-action/analyze@dd677812177e0c29f9c970a6c58d8607ae1bfefd # v4
49+
continue-on-error: true
50+
with:
51+
upload: false
52+
53+
- name: Upload SARIF (if Code Scanning enabled)
54+
uses: github/codeql-action/upload-sarif@dd677812177e0c29f9c970a6c58d8607ae1bfefd # v4
55+
continue-on-error: true
56+
with:
57+
sarif_file: ../results

.github/workflows/govulncheck.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Go Vulnerability Check
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
schedule:
9+
- cron: '0 0 * * 0' # Weekly on Sundays at midnight UTC
10+
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.ref }}
13+
cancel-in-progress: true
14+
15+
permissions:
16+
contents: read
17+
18+
jobs:
19+
govulncheck:
20+
name: Run govulncheck
21+
runs-on: ubuntu-latest
22+
23+
steps:
24+
- name: Checkout code
25+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
26+
27+
- name: Set up Go
28+
uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6
29+
with:
30+
go-version: '1.26.0'
31+
cache: true
32+
33+
- name: Install govulncheck
34+
run: go install golang.org/x/vuln/cmd/govulncheck@latest
35+
36+
- name: Run govulncheck
37+
run: govulncheck ./...

.github/workflows/pr-build.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ on:
1818
type: number
1919

2020
concurrency:
21-
group: "pr-build-${{ github.event.pull_request.number || github.ref }}"
21+
group: ${{ github.workflow }}-${{ github.ref }}
2222
cancel-in-progress: true
2323

2424
defaults:
@@ -45,7 +45,7 @@ jobs:
4545
steps:
4646
- name: Check if build is allowed
4747
id: check
48-
uses: actions/github-script@v7
48+
uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7
4949
with:
5050
script: |
5151
let allowed = false;
@@ -147,7 +147,7 @@ jobs:
147147
steps:
148148
- name: Get PR details
149149
id: pr
150-
uses: actions/github-script@v7
150+
uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7
151151
with:
152152
script: |
153153
let prNumber = '${{ needs.check-permission.outputs.pr_number }}';
@@ -181,12 +181,12 @@ jobs:
181181
core.setOutput('title', pr.data.title);
182182
183183
- name: Checkout code
184-
uses: actions/checkout@v4
184+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
185185
with:
186186
ref: ${{ steps.pr.outputs.sha }}
187187

188188
- name: Set up Go
189-
uses: actions/setup-go@v5
189+
uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5
190190
with:
191191
go-version: '${{ env.GO_VERSION }}'
192192
cache: true
@@ -311,11 +311,11 @@ jobs:
311311
EOF
312312
313313
- name: Comment on PR
314-
uses: actions/github-script@v7
314+
uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7
315315
with:
316316
script: |
317317
const fs = require('fs');
318-
const instructions = fs.readFileSync('cli/instructions.md', 'utf8');
318+
const instructions = fs.readFileSync('instructions.md', 'utf8');
319319
const prNumber = '${{ steps.pr.outputs.number }}';
320320
321321
const comments = await github.rest.issues.listComments({

.github/workflows/release-only.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ jobs:
2020

2121
steps:
2222
- name: Checkout
23-
uses: actions/checkout@v4
23+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
2424
with:
2525
fetch-depth: 0
2626

2727
- name: Set up Go (bootstrap)
28-
uses: actions/setup-go@v5
28+
uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5
2929
with:
3030
go-version: 'stable'
3131
cache: false

0 commit comments

Comments
 (0)