-
Notifications
You must be signed in to change notification settings - Fork 11
147 lines (128 loc) · 3.67 KB
/
dev-fe-gatekeeper.yaml
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
---
name: FE CI Gatekeeper
on:
push:
paths:
- "ui/**"
- ".github/workflows/dev-fe-gatekeeper.yaml"
- ".github/workflows/dev-fe-e2e.yaml"
branches:
- main
pull_request:
paths:
- "ui/**"
- ".github/workflows/dev-fe-gatekeeper.yaml"
- ".github/workflows/dev-fe-e2e.yaml"
types: [opened, synchronize]
permissions:
contents: write
packages: write
checks: write
pull-requests: write
repository-projects: read
env:
NODE_OPTIONS: "—-max_old_space_size=4096"
jobs:
cache_pnpm:
name: Cache PNPM
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
with:
lfs: true
ref: ${{ github.event.pull_request.head.sha }}
- uses: pnpm/action-setup@v4
with:
version: 9.4.0
- name: Use Node
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: "pnpm"
cache-dependency-path: "ui/pnpm-lock.yaml"
- name: Install dependencies
run: cd ui && make init
CI_checks:
runs-on: ubuntu-latest
needs: cache_pnpm
strategy:
matrix:
action: ["lint", "format", "test", "build"]
defaults:
run:
working-directory: ui
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
with:
lfs: true
ref: ${{ github.event.pull_request.head.sha }}
- uses: pnpm/action-setup@v4
with:
version: 9.4.0
- name: Use Node
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: "pnpm"
cache-dependency-path: "ui/pnpm-lock.yaml"
- run: make init
- name: lint
if: matrix.action == 'lint'
run: make lint
- name: format
if: matrix.action == 'format'
run: make format
- name: test
if: matrix.action == 'test'
run: make test
- name: build
if: matrix.action == 'build'
run: make build
- name: Check for changes
id: check_changes
run: |
git config --global user.email "[email protected]"
git config --global user.name "CI Bot"
git diff --exit-code || echo "::set-output name=changes::true"
- uses: stefanzweifel/git-auto-commit-action@v5
if: steps.check_changes.outputs.changes == 'true' && github.event_name == 'pull_request'
with:
commit_message: "chore: lint/format"
permission_checks:
runs-on: ubuntu-20.04
steps:
- name: Get User Permission
id: checkAccess
uses: actions-cool/check-user-permission@v2
with:
require: write
username: ${{ github.triggering_actor }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Check User Permission
if: steps.checkAccess.outputs.require-result == 'false'
run: |
echo "${{ github.triggering_actor }} does not have permissions on this repo."
exit 1
E2E_tests_workflow:
uses: ./.github/workflows/dev-fe-e2e.yaml
secrets:
CI_USER: everestadmin
CI_PASSWORD: everestadmin
merge-gatekeeper:
needs: [CI_checks, permission_checks, E2E_tests_workflow]
name: Merge Gatekeeper
if: ${{ always() }}
runs-on: ubuntu-22.04
steps:
- name: Run Merge Gatekeeper
uses: upsidr/[email protected]
with:
self: Merge Gatekeeper
token: ${{ secrets.GITHUB_TOKEN }}
interval: 45
timeout: 300
ignored: "license/snyk (Percona Github Org), security/snyk (Percona Github Org)"
ref: ${{ github.event.pull_request.head.sha || github.sha }}