Skip to content

Commit d75cbf8

Browse files
committed
fix: fix some Changelog CI detail
1 parent 803a625 commit d75cbf8

File tree

3 files changed

+20
-18
lines changed

3 files changed

+20
-18
lines changed

.github/workflows/commit-changelog.yml

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ name: Changelog CI
33
# Controls when the action will run. Triggers the workflow on a pull request
44
on:
55
pull_request:
6-
# types: [opened, reopened]
6+
types: [opened, reopened]
7+
branches:
8+
- master
79

810
jobs:
911
build:
@@ -12,23 +14,9 @@ jobs:
1214
steps:
1315
- uses: actions/checkout@v2
1416
with:
15-
ref: ${{ github.event.pull_request.head.ref }}
1617
fetch-depth: 0
1718
- name: Install Dependency
1819
run: npm i
1920

20-
- name: Config Internal Git
21-
run: |
22-
git config --global user.email "action@github.com"
23-
git config --global user.name "GitHub Action"
24-
25-
- name: Run Changelog CI & Bump npm version
26-
if: ${{ startsWith(github.event.pull_request.title, 'Release') }}
27-
run: npm run generate-changelog
28-
29-
- name: Copy & Deploy
30-
if: ${{ startsWith(github.event.pull_request.title, 'Release') }}
31-
run: |
32-
git add -A
33-
git commit -m '(Changelog CI) Added Changelog'
34-
git push
21+
- name: Run Changelog CI
22+
run: ./scripts/generate-changelog.sh

scripts/generate-changelog.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
3+
git checkout ${GITHUB_HEAD_REF}
4+
5+
git config --global user.email "action@github.com"
6+
git config --global user.name "GitHub Action"
7+
8+
npm run generate-changelog
9+
10+
git add -A
11+
git commit -m "(Changelog CI) Added Changelog"
12+
git push -u origin ${GITHUB_HEAD_REF} --tags

scripts/generate-changelog.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ const category = {
4141

4242
commitsArray.forEach((message) => {
4343
let cat: keyof typeof category;
44-
if (message.includes("test")) {
44+
if (/^([\d\.]+)$/.test(message)) {
45+
return;
46+
} else if (message.includes("test")) {
4547
cat = "miscs";
4648
} else if (/(add)|(support)/i.test(message)) {
4749
cat = "features";

0 commit comments

Comments
 (0)