Skip to content

Commit 2372c4b

Browse files
Merge pull request #6437 from ggiguash/github-comments-add-signature
USHIFT-6765: Add script signature when posting comments in PRs
2 parents 70e3ad5 + bf7d4c4 commit 2372c4b

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

.claude/scripts/microshift-prow-jobs-for-pull-requests.sh

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ GCS_BASE="https://storage.googleapis.com/test-platform-results"
1010
PROW_VIEW="https://prow.ci.openshift.org/view/gs/test-platform-results"
1111
GH_REPO="openshift/microshift"
1212
GCS_PR_PREFIX="pr-logs/pull/openshift_microshift"
13+
SIGNATURE=$'\n'"*Added by $(basename "${0}")* :robot:"$'\n'
1314

1415
# Get open PRs using GitHub CLI, optionally filtered by title substring and/or author
1516
fetch_open_prs() {
@@ -265,8 +266,11 @@ mode_approve() {
265266
fi
266267

267268
if [[ "${success}" -eq "${total}" ]]; then
269+
local comment=$'/lgtm\n/verified by ci\n'
270+
comment+="${SIGNATURE}"
271+
268272
echo "PR #${pr_number}: All ${total} jobs passed, approving..."
269-
gh pr comment "${pr_number}" --repo "${GH_REPO}" --body $'/lgtm\n/verified by ci'
273+
gh pr comment "${pr_number}" --repo "${GH_REPO}" --body "${comment}"
270274
echo "PR #${pr_number}: Approved"
271275
else
272276
echo "PR #${pr_number}: ${success}/${total} jobs passed, skipping"
@@ -332,8 +336,12 @@ mode_restart() {
332336
[[ -z "${short_name}" ]] && continue
333337
comment+="/test ${short_name}"$'\n'
334338
done
335-
# Remove trailing newline
336-
comment="${comment%$'\n'}"
339+
340+
if [[ -z "${comment}" ]]; then
341+
echo "PR #${pr_number}: Could not resolve rerun commands for failed job(s), skipping"
342+
continue
343+
fi
344+
comment+="${SIGNATURE}"
337345

338346
echo "PR #${pr_number}: Restarting ${#failed_jobs[@]} failed job(s): ${failed_jobs[*]}"
339347
gh pr comment "${pr_number}" --repo "${GH_REPO}" --body "${comment}"

0 commit comments

Comments
 (0)