-
Notifications
You must be signed in to change notification settings - Fork 6
130 lines (114 loc) · 5.41 KB
/
pr-main-check.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
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
# ╭──────────────────────────────────────────────────────────────────╮
# │ 🐙 GITHUB ACIONS CI/CD WORKFLOW │
# ┣──────────────────────────────────────────────────────────────────┫
# │ Responsible for: │
# │ ➤ [1] build check of project as a Docker Image │
# │ ➤ [2] build check of project as a Check PR Label │
# ╰──────────────────────────────────────────────────────────────────╯
name: '🔍 Pull-Request Check [main]'
on:
pull_request:
branches:
- main
types:
- opened
- reopened
- labeled
- unlabeled
- synchronize
env:
DOCKER_IMAGE: 'scores_web'
jobs:
# ╭──────────────────────────────────────────────────────────────────╮
# │ NOTE: │
# │ ➤ [1] check for correct build(s) │
# ╰──────────────────────────────────────────────────────────────────╯
npm-build-check:
name: 🪀 NPM Build Check
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
with:
ref: dev
- uses: actions/setup-node@v3
with:
node-version: 18.19.0
- name: '🏗️ Set npm version'
run: |
npm install -g [email protected]
- name: 'create .env'
run: |
echo ${{ secrets.ENV_FILE }} | base64 -d > .env
- name: '🟩 Build npm'
env:
NODE_OPTIONS: "--max-old-space-size=8192"
run: |
npm ci
npm run build
# docker-image-build:
# needs: npm-build-check
# name: 🐳 Docker Image Build
# runs-on: ubuntu-22.04
# steps:
# - uses: actions/checkout@v3
# - name: Build docker image
# run: |
# docker build . --file ./docker/prod.Dockerfile --tag ${{ env.DOCKER_IMAGE }}:$(date +%s)
# ╭──────────────────────────────────────────────────────────────────╮
# │ NOTE: │
# │ ➤ [2] check for correct PR Label │
# ╰──────────────────────────────────────────────────────────────────╯
check-labels:
name: 'Check PR Labels'
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: mheap/github-action-required-labels@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
mode: maximum
count: 1
labels: |
semver:patch
semver:minor
semver:major
# ╭──────────────────────────────────────────────────────────────────────────────────╮
# │ 💠 │ JOB | PULL-REQUEST FORMAT │
# ╰──────────────────────────────────────────────────────────────────────────────────╯
pull-request-format:
runs-on: ubuntu-22.04
name: 'JOB :|: pr format'
steps:
- name: 'STEP :|: checkout source code'
uses: actions/checkout@v4
with:
token: '${{ secrets.GH_TOKEN }}'
fetch-depth: 0
fetch-tags: true
ref: ${{ github.head_ref }}
- name: 'STEP :|: generate PR body'
id: testing
run: |
git fetch origin main:main
echo "$(git branch | cat)"
echo "$(git branch --show-current)"
git log main.. --format=%B | cat > ./temp-pr-body.md
echo "$(cat ./temp-pr-body.md)"
# ╭─────
# │ NOTE:
# │ |: Not recommended for use
# │ |: 🔗 read-more |:| https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
# ╰─────
- uses: tzkhan/pr-update-action@v2
with:
repo-token: "${{ secrets.GH_TOKEN }}"
base-branch-regex: '.*'
head-branch-regex: '.*'
title-template: '%headbranch%'
title-update-action: 'replace'
title-uppercase-head-match: false
body-template: null
# $(git log main.. --format=%B | cat)
body-update-action: 'replace'
body-uppercase-base-match: false