From d39a15c655127cf133342688d371a9324af89325 Mon Sep 17 00:00:00 2001 From: xingoxu Date: Wed, 23 Sep 2020 12:23:33 +0900 Subject: [PATCH] fix: fix some Changelog CI detail --- .github/workflows/commit-changelog.yml | 20 +++----------------- scripts/generate-changelog.sh | 12 ++++++++++++ scripts/generate-changelog.ts | 4 +++- 3 files changed, 18 insertions(+), 18 deletions(-) create mode 100755 scripts/generate-changelog.sh diff --git a/.github/workflows/commit-changelog.yml b/.github/workflows/commit-changelog.yml index 5eb90447f..bedd9b97a 100644 --- a/.github/workflows/commit-changelog.yml +++ b/.github/workflows/commit-changelog.yml @@ -3,7 +3,7 @@ name: Changelog CI # Controls when the action will run. Triggers the workflow on a pull request on: pull_request: - # types: [opened, reopened] + types: [opened, reopened] jobs: build: @@ -12,23 +12,9 @@ jobs: steps: - uses: actions/checkout@v2 with: - ref: ${{ github.event.pull_request.head.ref }} fetch-depth: 0 - name: Install Dependency run: npm i - - name: Config Internal Git - run: | - git config --global user.email "action@github.com" - git config --global user.name "GitHub Action" - - - name: Run Changelog CI & Bump npm version - if: ${{ startsWith(github.event.pull_request.title, 'Release') }} - run: npm run generate-changelog - - - name: Copy & Deploy - if: ${{ startsWith(github.event.pull_request.title, 'Release') }} - run: | - git add -A - git commit -m '(Changelog CI) Added Changelog' - git push + - name: Run Changelog CI + run: ./scripts/generate-changelog.sh diff --git a/scripts/generate-changelog.sh b/scripts/generate-changelog.sh new file mode 100755 index 000000000..04eaec193 --- /dev/null +++ b/scripts/generate-changelog.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +git checkout ${GITHUB_HEAD_REF} + +git config --global user.email "action@github.com" +git config --global user.name "GitHub Action" + +npm run generate-changelog + +git add -A +git commit -m "(Changelog CI) Added Changelog" +git push -u origin ${GITHUB_HEAD_REF} diff --git a/scripts/generate-changelog.ts b/scripts/generate-changelog.ts index b07d4a72b..3c672f821 100644 --- a/scripts/generate-changelog.ts +++ b/scripts/generate-changelog.ts @@ -41,7 +41,9 @@ const category = { commitsArray.forEach((message) => { let cat: keyof typeof category; - if (message.includes("test")) { + if (/^([\d\.]+)$/.test(message)) { + return; + } else if (message.includes("test")) { cat = "miscs"; } else if (/(add)|(support)/i.test(message)) { cat = "features";