Skip to content

Commit c58e1f1

Browse files
authored
fix: get commit message in GitHub workflow with description set (#20)
1 parent 3f07018 commit c58e1f1

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

.github/workflows/github-release-and-npm-package-publish.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,21 @@ jobs:
2222
ref: main # branch to checkout
2323
fetch-depth: 0
2424

25-
- name: Get last commit message
26-
run: echo "message=$(git log -1 --pretty=%B)" >> $GITHUB_ENV
27-
2825
- name: Check commit message suffix for `[create-release]`
2926
id: check_run_suffix_present
3027
uses: actions/github-script@v7
3128
with:
3229
script: |
30+
// Get last commit message
31+
// context.sha === context.payload.head_commit.id
32+
const lastCommitMessage = context.payload.head_commit.message;
33+
const lastCommitMessageFirstLine = lastCommitMessage.split('\n')[0];
34+
3335
let run_suffix_present = "false";
3436
let run_suffix_force_version = "";
3537
36-
const commitMessage = process.env.message;
37-
const regex = /\[create-release(?:-([a-z]+))?\]$/;
38-
const match = commitMessage.match(regex);
38+
const regex = /\[create-release(?:-([a-z]+))?\]/;
39+
const match = lastCommitMessageFirstLine.match(regex);
3940
4041
if (match) {
4142
run_suffix_present = "true";

0 commit comments

Comments
 (0)