Skip to content

Commit ec12ee7

Browse files
authored
Mention who triggered the release in the release PR (#4753)
* Mention who triggered the release in the release PR * Search for the PR against the right base * Use printf -v
1 parent 509be25 commit ec12ee7

1 file changed

Lines changed: 15 additions & 8 deletions

File tree

.github/workflows/upsert-release-pr.yml

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -122,14 +122,13 @@ jobs:
122122
# trigger other workflows. So we use the token created in the
123123
# previous step.
124124
GITHUB_TOKEN: ${{ steps.setup-github-token.outputs.access-token }}
125-
- name: Annotate release PR with streams build option
126-
if: env.BUILD_STREAMS_ADAPTER_IMAGES == 'true'
125+
- name: Annotate release PR description
127126
env:
128127
GITHUB_TOKEN: ${{ steps.setup-github-token.outputs.access-token }}
129128
# We use gh pr list with exact title match instead of --search to avoid GitHub search index lag
130129
run: |
131130
PR_NUMBER=$(gh pr list \
132-
--base main \
131+
--base "${{ github.ref_name }}" \
133132
--state open \
134133
--json number,title \
135134
--jq ".[] | select(.title == \"Release $BUMPED_VERSION\") | .number")
@@ -140,14 +139,22 @@ jobs:
140139
fi
141140
142141
PR_BODY=$(gh pr view "$PR_NUMBER" --json body --jq '.body')
143-
MARKER='<!-- build-streams-adapter-images:true -->'
144142
145-
if [[ "$PR_BODY" == *"$MARKER"* ]]; then
146-
echo "Streams marker already present in PR body"
147-
exit 0
143+
printf -v PR_BODY_PREFIX "This release was triggered by @%s.\n\n" "${{ github.actor }}"
144+
PR_BODY_SUFFIX=""
145+
146+
if [[ "$BUILD_STREAMS_ADAPTER_IMAGES" = "true" ]]; then
147+
MARKER='<!-- build-streams-adapter-images:true -->'
148+
149+
if [[ "$PR_BODY" == *"$MARKER"* ]]; then
150+
echo "Streams marker already present in PR body"
151+
exit 0
152+
fi
153+
154+
printf -v PR_BODY_SUFFIX "\n\n## Release Options\n%s\n- [x] Build streams adapter images\n" "$MARKER"
148155
fi
149156
150-
UPDATED_BODY=$(printf "%s\n\n## Release Options\n%s\n- [x] Build streams adapter images\n" "$PR_BODY" "$MARKER")
157+
printf -v UPDATED_BODY "%s%s%s" "$PR_BODY_PREFIX" "$PR_BODY" "$PR_BODY_SUFFIX"
151158
152159
gh api \
153160
--method PATCH \

0 commit comments

Comments
 (0)