-
Notifications
You must be signed in to change notification settings - Fork 0
85 lines (71 loc) · 2.24 KB
/
ci.yml
File metadata and controls
85 lines (71 loc) · 2.24 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
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
lint:
name: Lint YAML
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Install yamllint
run: pip install yamllint
- name: Run yamllint
run: yamllint -c .yamllint.yaml .
validate:
name: Validate (${{ matrix.environment }})
runs-on: ubuntu-latest
needs: lint
strategy:
fail-fast: false
matrix:
environment: [dev, staging, production]
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Install kustomize
uses: imranismail/setup-kustomize@v3
- name: Install Helm
uses: azure/setup-helm@v5
- name: Build overlays
run: |
echo "Building ${{ matrix.environment }} overlays..."
find . -path "*/overlays/${{ matrix.environment }}/kustomization.yaml" -exec dirname {} \; | while read dir; do
echo "Building $dir ..."
kustomize build --enable-helm "$dir" > /dev/null || exit 1
done
echo "All ${{ matrix.environment }} overlays built successfully."
pr-summary:
name: PR Summary
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
needs: [lint, validate]
permissions:
pull-requests: write
steps:
- name: Comment on PR
uses: actions/github-script@v9
with:
script: |
const environments = ['dev', 'staging', 'production'];
const rows = environments.map(env => {
const job = context.payload.workflow_run?.jobs?.find(j => j.name.includes(env));
return `| ${env} | :white_check_mark: |`;
}).join('\n');
const body = `## CI Results
| Check | Status |
|-------|--------|
| YAML Lint | :white_check_mark: |
| Environment | Kustomize Build |
|-------------|-----------------|
${rows}
All validations passed.`;
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: body
});