-
-
Notifications
You must be signed in to change notification settings - Fork 21
86 lines (82 loc) · 2.19 KB
/
ci.yml
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
name: CI
on:
push:
branches:
- main
paths:
- "deployment/**"
- ".github/**"
pull_request:
branches:
- main
paths:
- "deployment/**"
- ".github/**"
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
with:
scan-type: 'config'
scan-ref: '.'
format: 'sarif'
output: 'trivy-results.sarif'
- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: 'trivy-results.sarif'
k8s-test:
runs-on: ubuntu-latest
needs: [build]
if: ${{ github.event_name == 'pull_request' }}
steps:
- name: Create k8s Kind Cluster
uses: helm/[email protected]
- name: Check out repository code
uses: actions/checkout@v4
- name: Run K8s test
run: |
kubectl cluster-info
kubectl apply -k deployment/
kubectl get all -A
auto-approve:
runs-on: ubuntu-latest
needs: [build, k8s-test]
if: ${{ github.event_name == 'pull_request' }}
steps:
- name: Auto Approve PR
uses: actions/github-script@v7
with:
github-token: ${{ github.token }}
script: |
github.rest.pulls.createReview({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number,
event: "APPROVE"
})
# auto-merge:
# runs-on: ubuntu-latest
# needs: [auto-approve]
# if: ${{ github.event_name == 'pull_request' }}
# env:
# PR_NUMBER: ${{ github.event.number }}
# steps:
# - name: Check out repository code
# uses: actions/checkout@v4
# - name: Auto Merge PR
# uses: actions/github-script@v7
# with:
# github-token: ${{ github.token }}
# script: |
# await github.rest.pulls.merge({
# merge_method: 'squash',
# owner: context.repo.owner,
# pull_number: process.env.PR_NUMBER,
# repo: context.repo.repo
# });