-
Notifications
You must be signed in to change notification settings - Fork 0
103 lines (97 loc) · 4.15 KB
/
gha-security-checks.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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
name: GHA Security Checks
on:
push:
branches:
- master
- main
- develop
- staging
- refs/tags/v**
jobs:
security_check_development:
runs-on: ubuntu-latest
# if: startsWith(github.ref, 'refs/heads/develop')
if: ${{ (startsWith(github.ref, 'refs/heads/develop') && contains('["tainguyenbp"]', github.actor)) }}
environment: development
# runs-on: [self-hosted, Linux, X64] # run with runner self hosted
steps:
- name: Check Repository Name Changes
if: startsWith(github.ref, 'refs/heads/develop')
run: |
if [ "$(git diff --name-only ${{ github.event.before }} ${{ github.sha }})" != "" ]; then
echo "Repository name changed. Triggering security checks..."
echo "${{ github.event.before }} - ${{ github.sha }}"
# Add security checks and notifications here
else
echo "No repository name change detected."
fi
security_check_staging:
runs-on: ubuntu-latest
# if: startsWith(github.ref, 'refs/heads/staging')
if: ${{ (startsWith(github.ref, 'refs/heads/staging') && contains('["tainguyenbp"]', github.actor)) }}
environment: staging
# runs-on: [self-hosted, Linux, X64] # run with runner self hosted
steps:
- name: Check Repository Name Changes
if: startsWith(github.ref, 'refs/heads/staging')
run: |
if [ "$(git diff --name-only ${{ github.event.before }} ${{ github.sha }})" != "" ]; then
echo "Repository name changed. Triggering security checks..."
echo "${{ github.event.before }} - ${{ github.sha }}"
# Add security checks and notifications here
# You can send telegram notifications
else
echo "No repository name change detected."
fi
security_check_production:
runs-on: ubuntu-latest
# if: startsWith(github.ref, 'refs/heads/master')
if: ${{ (startsWith(github.ref, 'refs/heads/master') && contains('["tainguyenbp"]', github.actor)) }}
environment: production
# runs-on: [self-hosted, Linux, X64] # run with runner self hosted
steps:
- name: Check Repository Name Changes
if: startsWith(github.ref, 'refs/heads/master')
run: |
if [ "$(git diff --name-only ${{ github.event.before }} ${{ github.sha }})" != "" ]; then
echo "Repository name changed. Triggering security checks..."
echo "${{ github.event.before }} - ${{ github.sha }}"
# Add security checks and notifications here
# You can send telegram notifications
else
echo "No repository name change detected."
fi
security_check_production_tagging:
runs-on: ubuntu-latest
if: ${{ (startsWith(github.ref, 'refs/tags/v') && contains('["tainguyenbp"]', github.actor)) }}
environment: production
# runs-on: [self-hosted, Linux, X64] # run with runner self hosted
steps:
- name: Check Repository Name Changes
if: startsWith(github.ref, 'refs/tags/v') # matching with tagging
run: |
if [ "$(git diff --name-only ${{ github.event.before }} ${{ github.sha }})" != "" ]; then
echo "Repository name changed. Triggering security checks..."
# Add security checks and notifications here
# You can send telegram notifications
else
echo "No repository name change detected."
fi
security_check_production_main:
runs-on: ubuntu-latest
# if: startsWith(github.ref, 'refs/heads/main')
if: ${{ (startsWith(github.ref, 'refs/heads/main') && contains('["tainguyenbp"]', github.actor)) }}
environment: production
# runs-on: [self-hosted, Linux, X64] # run with runner self hosted
steps:
- name: Check Repository Name Changes
if: startsWith(github.ref, 'refs/heads/main')
run: |
if [ "$(git diff --name-only ${{ github.event.before }} ${{ github.sha }})" != "" ]; then
echo "Repository name changed. Triggering security checks..."
echo "${{ github.event.before }} - ${{ github.sha }}"
# Add security checks and notifications here
# You can send telegram notifications
else
echo "No repository name change detected."
fi