Skip to content

Commit b21f1ff

Browse files
committed
feat: /codeboarding posts a new comment per run instead of updating in place
On-demand /codeboarding (issue_comment) now uses a run-unique sticky header, so each invocation creates a fresh comment and leaves earlier ones (the auto on-open comment and prior /codeboarding results) intact. Automatic pull_request runs keep the stable header and update in place as before. The header is resolved once in the guard step (written up front so the failure-comment step always has it).
1 parent fdcbe16 commit b21f1ff

2 files changed

Lines changed: 18 additions & 4 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ This table mirrors the engine and may lag it. The source of truth is the engine'
145145
## When it runs
146146

147147
- On a PR being opened, reopened, or marked ready for review, the diagram is generated once (per the `on:` triggers above). It does not re-run on every push, so you never spend an LLM job per commit; the comment reflects that point until refreshed.
148-
- On a `/codeboarding` comment, a trusted collaborator (`OWNER`, `MEMBER`, or `COLLABORATOR`) regenerates the diagram against the current PR head, even if one already exists. It re-runs and updates the same comment in place. Change the keyword via `trigger_command`.
148+
- On a `/codeboarding` comment, a trusted collaborator (`OWNER`, `MEMBER`, or `COLLABORATOR`) regenerates the diagram against the current PR head, even if one already exists. Each `/codeboarding` invocation posts a **new** comment and leaves earlier comments untouched (the automatic on-open comment, and any previous `/codeboarding` results, stay put). Change the keyword via `trigger_command`.
149149

150150
The command needs the `issue_comment` trigger and runs from your default branch (a GitHub rule), so it only works once the workflow is merged there. On-demand runs on fork PRs are refused, so fork code is never analyzed with your secrets.
151151

action.yml

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,20 @@ runs:
9797
set -uo pipefail
9898
skip() { echo "::notice::$1 Skipping."; echo "skip=true" >> "$GITHUB_OUTPUT"; exit 0; }
9999
100+
# Sticky-comment targeting. Written up front so the failure-comment step
101+
# always has a header even if PR resolution below fails. Automatic
102+
# pull_request runs reuse one stable header → the comment is updated in
103+
# place. An on-demand /codeboarding run uses a run-unique header so it
104+
# posts a NEW comment and never touches comments from earlier runs; its
105+
# own in-progress→result→failure steps still share it (one comment per
106+
# invocation). Re-running the same run keeps the same run id, so a re-run
107+
# updates that invocation's comment rather than spawning another.
108+
if [ "$EVENT" = "issue_comment" ]; then
109+
echo "sticky_header=codeboarding-architecture-diff-run-${GITHUB_RUN_ID}" >> "$GITHUB_OUTPUT"
110+
else
111+
echo "sticky_header=codeboarding-architecture-diff" >> "$GITHUB_OUTPUT"
112+
fi
113+
100114
if [ "$EVENT" = "pull_request" ]; then
101115
PR_NUMBER="$PR_NUMBER_PULL"
102116
BASE_SHA="$PULL_BASE_SHA"
@@ -160,7 +174,7 @@ runs:
160174
continue-on-error: true
161175
uses: marocchino/sticky-pull-request-comment@v2
162176
with:
163-
header: codeboarding-architecture-diff
177+
header: ${{ steps.guard.outputs.sticky_header }}
164178
number: ${{ steps.guard.outputs.pr_number }}
165179
message: |
166180
### ${{ inputs.comment_header }} · analyzing…
@@ -609,7 +623,7 @@ runs:
609623
if: steps.guard.outputs.skip != 'true'
610624
uses: marocchino/sticky-pull-request-comment@v2
611625
with:
612-
header: codeboarding-architecture-diff
626+
header: ${{ steps.guard.outputs.sticky_header }}
613627
number: ${{ steps.guard.outputs.pr_number }}
614628
path: ${{ steps.body.outputs.body_file }}
615629
GITHUB_TOKEN: ${{ inputs.github_token }}
@@ -621,7 +635,7 @@ runs:
621635
continue-on-error: true
622636
uses: marocchino/sticky-pull-request-comment@v2
623637
with:
624-
header: codeboarding-architecture-diff
638+
header: ${{ steps.guard.outputs.sticky_header }}
625639
number: ${{ steps.guard.outputs.pr_number }}
626640
message: |
627641
### ${{ inputs.comment_header }} · failed

0 commit comments

Comments
 (0)