Skip to content

Commit b2fd271

Browse files
committed
build: move pr_commits fetch before pr_author_emails computation in generate_pr_commit_message
The `pr_author_emails` list referenced `$pr_commits` to extract commit author emails, but `pr_commits` was fetched afterwards, causing the variable to be empty. This resulted in PR authors being incorrectly added to the "Co-authored-by" trailer when their commit email didn't match their GitHub noreply address. --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent 257b05e commit b2fd271

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

.github/workflows/scripts/generate_pr_commit_message

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,9 @@ main() {
153153
# Resolve the PR author's name and email using .mailmap:
154154
pr_author_resolved=$(resolve_user "$pr_author_login")
155155

156+
# Fetch commits in the PR:
157+
pr_commits=$(github_api "GET" "/repos/$REPO_OWNER/$REPO_NAME/pulls/$pr_number/commits")
158+
156159
pr_author_id=$(echo "$pr_details" | jq -r '.user.id')
157160
pr_author_emails=$(
158161
{
@@ -181,9 +184,6 @@ main() {
181184
pr_reviews=$(github_api "GET" "/repos/$REPO_OWNER/$REPO_NAME/pulls/$pr_number/reviews")
182185
reviewers=$(echo "$pr_reviews" | jq -r '.[] | select(.state == "APPROVED" ) | .user.login' | sort -u)
183186

184-
# Fetch commits in the PR:
185-
pr_commits=$(github_api "GET" "/repos/$REPO_OWNER/$REPO_NAME/pulls/$pr_number/commits")
186-
187187
# Extract co-authors from commit messages:
188188
co_authors=$(echo "$pr_commits" | jq -r '.[].commit.message' | grep -Eio 'Co-authored-by:.*' | sort -u)
189189
processed_co_authors=""

0 commit comments

Comments
 (0)