Skip to content

Commit

Permalink
build: tweak generated comment and run on PR target
Browse files Browse the repository at this point in the history
  • Loading branch information
Planeshifter committed Sep 24, 2024
1 parent 8f72b43 commit d03fea5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/generate_pr_commit_message.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,19 @@ name: generate_pr_commit_message

# Workflow triggers:
on:
pull_request:
pull_request_target:
types:
- labeled

# Global permissions:
permissions:
# Allow read-only access to the repository contents:
contents: read

# Allow write access to issues, assignees, labels, and milestones:
issues: write

# Allow write access to pull requests:
pull-requests: write

# Workflow jobs:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/scripts/generate_pr_commit_message
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ main() {
pr_commits=$(github_api "GET" "/repos/$REPO_OWNER/$REPO_NAME/pulls/$pr_number/commits")

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

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

0 comments on commit d03fea5

Please sign in to comment.