Skip to content

Commit b3e850a

Browse files
danbarrclaude
andauthored
Bump releaseo to v0.0.3 and preserve original release actor through workflow chain (#3560)
* Preserve original release actor through workflow chain Add steps to preserve the GitHub actor who triggered the release workflow, passing it through to downstream workflows like docs-website updates. Changes: - create-release-tag.yml: Extract Release-Triggered-By git trailer from commit and embed in release body as HTML comment - releaser.yml: Add extract-release-actor job to parse release body and pass actor to update-docs-website and Slack notifications * Bump releaseo to v0.0.3 --------- Signed-off-by: Dan Barr <6922515+danbarr@users.noreply.github.com> Co-authored-by: Dan Barr <6922515+danbarr@users.noreply.github.com> Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent a73bf3d commit b3e850a

3 files changed

Lines changed: 60 additions & 7 deletions

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242

4343
- name: Create Release PR
4444
id: release
45-
uses: stacklok/releaseo@add86e3cc417a4442ecef272dc79b46c2eb63246 # v0.0.2
45+
uses: stacklok/releaseo@b7022753f832cac36a9e07769a679a7c1ca72fe2 # v0.0.3
4646
with:
4747
releaseo_version: v0.0.1
4848
bump_type: ${{ inputs.bump_type }}

.github/workflows/create-release-tag.yml

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,21 @@ jobs:
9696
exit 1
9797
fi
9898
99+
- name: Extract release triggering actor
100+
id: actor
101+
run: |
102+
# Extract the Release-Triggered-By trailer from the commit
103+
# This trailer is added by releaseo to preserve the original workflow triggerer
104+
TRIGGERED_BY=$(git log -1 --format='%(trailers:key=Release-Triggered-By,valueonly)' | tr -d '[:space:]')
105+
106+
if [ -n "$TRIGGERED_BY" ]; then
107+
echo "✅ Found release triggering actor: $TRIGGERED_BY"
108+
echo "triggered_by=$TRIGGERED_BY" >> $GITHUB_OUTPUT
109+
else
110+
echo "⚠️ No Release-Triggered-By trailer found in commit"
111+
echo "triggered_by=" >> $GITHUB_OUTPUT
112+
fi
113+
99114
- name: Check if tag exists
100115
id: check-tag
101116
run: |
@@ -112,6 +127,8 @@ jobs:
112127
if: steps.check-tag.outputs.exists == 'false'
113128
run: |
114129
TAG="v${{ steps.version.outputs.version }}"
130+
TRIGGERED_BY="${{ steps.actor.outputs.triggered_by }}"
131+
115132
git config user.name "github-actions[bot]"
116133
git config user.email "github-actions[bot]@users.noreply.github.com"
117134
git tag -a "$TAG" -m "Release $TAG"
@@ -120,9 +137,17 @@ jobs:
120137
121138
# Create GitHub Release (triggers releaser.yml via release event)
122139
# Note: Must use PAT (GH_TOKEN) because GITHUB_TOKEN cannot trigger other workflows
123-
gh release create "$TAG" \
124-
--title "Release $TAG" \
125-
--generate-notes
140+
# Include actor metadata as HTML comment if available (parsed by releaser.yml)
141+
if [ -n "$TRIGGERED_BY" ]; then
142+
gh release create "$TAG" \
143+
--title "Release $TAG" \
144+
--generate-notes \
145+
--notes "<!-- Release-Triggered-By: $TRIGGERED_BY -->"
146+
else
147+
gh release create "$TAG" \
148+
--title "Release $TAG" \
149+
--generate-notes
150+
fi
126151
echo "Created GitHub Release: $TAG"
127152
env:
128153
GH_TOKEN: ${{ secrets.RELEASE_TOKEN }}

.github/workflows/releaser.yml

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,14 +187,41 @@ jobs:
187187
id-token: write
188188
uses: ./.github/workflows/helm-publish.yml
189189

190+
extract-release-actor:
191+
name: Extract Release Actor
192+
runs-on: ubuntu-slim
193+
outputs:
194+
triggered_by: ${{ steps.extract.outputs.triggered_by }}
195+
permissions:
196+
contents: read
197+
steps:
198+
- name: Extract actor from release body
199+
id: extract
200+
env:
201+
GH_TOKEN: ${{ github.token }}
202+
run: |
203+
# Fetch the release body and extract the Release-Triggered-By metadata
204+
RELEASE_BODY=$(gh release view "${{ github.ref_name }}" --repo "${{ github.repository }}" --json body --jq '.body')
205+
206+
# Extract username from HTML comment: <!-- Release-Triggered-By: username -->
207+
TRIGGERED_BY=$(echo "$RELEASE_BODY" | grep -oP '(?<=<!-- Release-Triggered-By: )[^[:space:]]+(?= -->)' || true)
208+
209+
if [ -n "$TRIGGERED_BY" ]; then
210+
echo "Found release triggering actor: $TRIGGERED_BY"
211+
echo "triggered_by=$TRIGGERED_BY" >> $GITHUB_OUTPUT
212+
else
213+
echo "No Release-Triggered-By metadata found, falling back to github.actor"
214+
echo "triggered_by=${{ github.actor }}" >> $GITHUB_OUTPUT
215+
fi
216+
190217
update-docs-website:
191218
name: Trigger Docs Update
192-
needs: [ publish-helm ]
219+
needs: [ publish-helm, extract-release-actor ]
193220
permissions: {}
194221
uses: ./.github/workflows/update-docs-website.yml
195222
with:
196223
version: ${{ github.ref_name }}
197-
assign_to: ${{ github.actor }}
224+
assign_to: ${{ needs.extract-release-actor.outputs.triggered_by }}
198225
secrets:
199226
DOCS_REPO_DISPATCH_TOKEN: ${{ secrets.DOCS_REPO_DISPATCH_TOKEN }}
200227

@@ -259,6 +286,7 @@ jobs:
259286
- image-build-and-push
260287
- update-docs-website
261288
- publish-helm
289+
- extract-release-actor
262290
if: ${{ failure() }}
263291
runs-on: ubuntu-slim
264292
permissions: {}
@@ -288,7 +316,7 @@ jobs:
288316
},
289317
{
290318
"type": "mrkdwn",
291-
"text": "*Triggered by:*\n${{ github.actor }}"
319+
"text": "*Triggered by:*\n${{ needs.extract-release-actor.outputs.triggered_by || github.actor }}"
292320
}
293321
]
294322
},

0 commit comments

Comments
 (0)