Skip to content

Commit 7464bb1

Browse files
committed
ci(shell): fix get cc_type and cc_scope
1 parent 4743954 commit 7464bb1

1 file changed

Lines changed: 12 additions & 5 deletions

File tree

.github/workflows/ci.yml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,19 @@ jobs:
6363

6464
readarray -t CC <<< "$(
6565
node -e '
66-
const msg = process.argv.slice(2).join(" ");
67-
const m = msg.match(/^(feat|fix|chore|refactor|ci|test)(?:\(([^)]+)\))?/);
68-
console.log((m?.[1]||""));
69-
console.log((m?.[2]||""));
70-
' -- "$COMMIT_MESSAGE"
66+
const subject = (process.argv[2] || "").trim();
67+
const re = /^(feat|fix|chore|refactor|ci|test|docs|perf|style|build|ops|release|revert)(?:\(([^\)\r\n]+)\))?(?:!)?:\s/i;
68+
const m = subject.match(re);
69+
const type = (m?.[1] || "").toLowerCase();
70+
const scope = (m?.[2] || "");
71+
console.log(type);
72+
console.log(scope);
73+
' -- "$COMMIT_SUBJECT"
7174
)"
7275
CC_TYPE="${CC[0]}"
7376
CC_SCOPE="${CC[1]}"
7477
78+
7579
7680
{
7781
echo 'COMMIT_MESSAGE<<EOF'
@@ -84,6 +88,9 @@ jobs:
8488
echo "CC_TYPE=$CC_TYPE"
8589
echo "CC_SCOPE=$CC_SCOPE"
8690
} >> "$GITHUB_ENV"
91+
92+
echo "Subject: $COMMIT_SUBJECT"
93+
echo "CC_TYPE=$CC_TYPE CC_SCOPE=$CC_SCOPE"
8794

8895
- name: Build metrics JSON
8996
run: node scripts/collect-ci.js

0 commit comments

Comments
 (0)