Skip to content

Commit 1bdf971

Browse files
authored
fix: only comment on PR when recordings are actually pushed (#5218)
## Summary - Gate the "Recordings committed successfully" PR comment on whether recordings were actually pushed - Adds `pushed` output to the commit step, set to `true` only on successful push - Prevents misleading comments on PRs with no new recordings ## Test plan - [x] Tested all four code paths locally (no changes, successful push, maintainerCanModify false, step skipped) Signed-off-by: Charlie Doern <cdoern@redhat.com>
1 parent f01ded5 commit 1bdf971

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

.github/workflows/commit-recordings.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ jobs:
231231
fi
232232
233233
- name: Commit and push recordings
234+
id: commit
234235
if: steps.pr-info.outputs.skip != 'true'
235236
env:
236237
GH_TOKEN: ${{ steps.pr-info.outputs.is_fork_pr == 'true' && secrets.RELEASE_PAT || github.token }}
@@ -247,6 +248,7 @@ jobs:
247248
# Check if there are recording changes
248249
if [[ -z $(git status --porcelain tests/integration/recordings/ tests/integration/*/recordings/) ]]; then
249250
echo "No recording changes to commit"
251+
echo "pushed=false" >> "$GITHUB_OUTPUT"
250252
exit 0
251253
fi
252254
@@ -268,19 +270,22 @@ jobs:
268270
echo "Maintainer can modify - pushing to fork PR branch"
269271
git push "https://x-access-token:${GH_TOKEN}@github.com/${HEAD_REPO}.git" "HEAD:${HEAD_REF}"
270272
echo "Successfully pushed recordings to fork PR"
273+
echo "pushed=true" >> "$GITHUB_OUTPUT"
271274
else
272275
echo "::warning::Cannot push to fork PR: 'Allow edits from maintainers' is not enabled"
273276
echo "::warning::Contributor needs to check 'Allow edits from maintainers' when creating the PR"
277+
echo "pushed=false" >> "$GITHUB_OUTPUT"
274278
exit 0
275279
fi
276280
else
277281
echo "Pushing to same-repo PR branch: $HEAD_REF"
278282
git push origin "HEAD:${HEAD_REF}"
279283
echo "Successfully pushed recordings"
284+
echo "pushed=true" >> "$GITHUB_OUTPUT"
280285
fi
281286
282287
- name: Comment on PR
283-
if: steps.pr-info.outputs.skip != 'true'
288+
if: steps.commit.outputs.pushed == 'true'
284289
uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7
285290
env:
286291
PR_NUMBER: ${{ steps.pr-info.outputs.pr_number }}

0 commit comments

Comments
 (0)