-
-
Notifications
You must be signed in to change notification settings - Fork 4
87 lines (71 loc) · 2.87 KB
/
Copy pathci.yml
File metadata and controls
87 lines (71 loc) · 2.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
name: CI
on:
push:
branches: [main]
pull_request:
workflow_dispatch:
permissions:
contents: read
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0
with:
go-version-file: go.mod
- name: Build
run: go build ./...
- name: Test
run: go test -race -vet=off ./...
- name: Vet
run: go vet ./... || echo "::warning::go vet found issues (non-blocking)"
doc-examples:
runs-on: ubuntu-latest
if: github.event_name == 'workflow_dispatch'
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0
with:
go-version-file: go.mod
- name: Check doc example markers
run: make check-doc-examples
- name: Install trivy
run: |
curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/75c4dc0f45c5d7ffd05ae26df1e0c666787bdf2a/contrib/install.sh \
| sh -s -- -b /usr/local/bin v0.69.3
- name: Update doc examples
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
go build -o uzomuzo ./cmd/uzomuzo
go run ./scripts/update-doc-examples --skip-build
- name: Create PR with updated doc examples
env:
# PAT required — GITHUB_TOKEN push does not trigger CI on the new branch.
GH_TOKEN: ${{ secrets.GH_ACTIONS_TOKEN }}
run: |
git diff --quiet README.md docs/usage.md docs/assets/juice-shop-eol-result.txt && echo "No changes" && exit 0
BRANCH="docs/update-examples-$(date +%Y%m%d-%H%M%S)"
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git remote set-url origin "https://x-access-token:${GH_TOKEN}@github.com/${{ github.repository }}.git"
git checkout -b "$BRANCH"
git add README.md docs/usage.md docs/assets/juice-shop-eol-result.txt
git commit -m "docs: update output examples"
git push -u origin "$BRANCH"
gh pr create \
--title "docs: refresh output examples" \
--body "Automated refresh of documentation output examples via \`workflow_dispatch\` (including juice-shop SBOM scan)." \
--base main
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0
with:
go-version-file: go.mod
- uses: golangci/golangci-lint-action@ba0d7d2ec06a0ea1cb5fa41b2e4a3ab91d21278a # v9.3.0