Skip to content

Commit d03fea5

Browse files
committed
build: tweak generated comment and run on PR target
1 parent 8f72b43 commit d03fea5

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

.github/workflows/generate_pr_commit_message.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,19 @@ name: generate_pr_commit_message
2121

2222
# Workflow triggers:
2323
on:
24-
pull_request:
24+
pull_request_target:
2525
types:
2626
- labeled
2727

2828
# Global permissions:
2929
permissions:
30+
# Allow read-only access to the repository contents:
3031
contents: read
32+
33+
# Allow write access to issues, assignees, labels, and milestones:
3134
issues: write
35+
36+
# Allow write access to pull requests:
3237
pull-requests: write
3338

3439
# Workflow jobs:

.github/workflows/scripts/generate_pr_commit_message

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ main() {
112112
pr_commits=$(github_api "GET" "/repos/$REPO_OWNER/$REPO_NAME/pulls/$pr_number/commits")
113113

114114
# Extract co-authors from commits:
115-
co_authors=$(echo "$pr_commits" | jq -r '.[].commit.message' | grep -i "Co-authored-by:" | awk -F': ' '{print $2}' | sort | uniq | paste -sd '\n' -)
115+
co_authors=$(echo "$pr_commits" | jq -r '.[].commit.message' | grep -Eio "Co-authored-by:.*" | sort -u)
116116

117117
# Extract 'Signed-off-by' lines from commits:
118118
signed_off_bys=$(echo "$pr_commits" | jq -r '.[].commit.message' | grep -Eio 'Signed-off-by:.*' | sort -u)
@@ -147,6 +147,7 @@ main() {
147147
if [ -n "$ref_issues" ]; then
148148
commit_body+="\n$ref_issues"
149149
fi
150+
commit_body+="\n"
150151
if [ -n "$co_authors" ]; then
151152
commit_body+="\n$co_authors"
152153
fi

0 commit comments

Comments
 (0)