-
Notifications
You must be signed in to change notification settings - Fork 1
89 lines (76 loc) · 2.76 KB
/
pr.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
name: pr
on:
# By default, a workflow only runs when a pull_request's activity type
# is opened, synchronize, or reopened. We explicity override here so that
# PR titles are re-linted when the PR text content is edited.
pull_request:
types: [opened, edited, reopened, synchronize]
jobs:
size-label:
runs-on: ubuntu-22.04
steps:
- uses: pascalgn/[email protected]
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
with:
sizes: >
{
"0": "XS",
"25": "S",
"150": "M",
"500": "L",
"1000": "XL"
}
conventional-title:
runs-on: ubuntu-22.04
steps:
- uses: morrisoncole/[email protected]
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
title-regex: "^(feat|fix|docs|style|refactor|perf|test|build|ci|chore): .{1,}"
on-failed-regex-fail-action: true
on-failed-regex-create-review: true
on-failed-regex-request-changes: true
on-failed-regex-comment:
"Please stick to Conventional Commits syntax for PR titles ;)"
on-succeeded-regex-dismiss-review-comment:
"Thank you <3"
version-bump-label:
runs-on: ubuntu-22.04
steps:
- name: Checkout Code
uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.CHANGELOG_TOKEN }}
- name: Check version bump
run: |
GIT='git --git-dir='$PWD'/.git'
NEW_COMMIT_VERSION="$(cat hypercomplex/VERSION | grep -oE '[0-9.]+')"
$GIT checkout HEAD~1
PREVIOUS_COMMIT_VERSION="$(cat hypercomplex/VERSION | grep -oE '[0-9.]+')"
echo PREVIOUS_COMMIT_VERSION $PREVIOUS_COMMIT_VERSION
echo NEW_COMMIT_VERSION $NEW_COMMIT_VERSION
$GIT checkout -
if [[ "$NEW_COMMIT_VERSION" != "$PREVIOUS_COMMIT_VERSION" ]]
then
IFS='.' read -r NEW_MAJOR NEW_MINOR NEW_PATCH <<< "$NEW_COMMIT_VERSION"
IFS='.' read -r PREVIOUS_MAJOR PREVIOUS_MINOR PREVIOUS_PATCH <<< "$PREVIOUS_COMMIT_VERSION"
if [[ "$NEW_PATCH" != "$PREVIOUS_PATCH" ]]
then
echo "LABEL=release:patch" >> $GITHUB_ENV
fi
if [[ "$NEW_MINOR" != "$PREVIOUS_MINOR" ]]
then
echo "LABEL=release:minor" >> $GITHUB_ENV
fi
if [[ "$NEW_MAJOR" != "$PREVIOUS_MAJOR" ]]
then
echo "LABEL=release:major" >> $GITHUB_ENV
fi
fi
- name: Add version bump label
if: ${{env.LABEL != ''}}
uses: actions-ecosystem/action-add-labels@v1
with:
labels: "${{ env.LABEL }}"