Skip to content

Commit 6eda2da

Browse files
fix(#2797): create ready-for-triage label before use in post-retro.sh
post-retro.sh passed --label "ready-for-triage" to gh issue create without ensuring the label existed in the target repo. This caused the retro workflow to fail with exit code 1 on repos that predate PR #2679 (which introduced the label in the scaffold template). Add a gh label create --force call before gh issue create, following the same idempotent pattern used in post-review.sh for the ready-for-merge and requires-manual-review labels. The --force flag makes the call a no-op when the label already exists. Also adds a mock handler for gh label create in the test harness and a test case verifying the label is created before the issue. Note: pre-commit could not run (shellcheck-py failed to install in sandbox due to network restrictions). Post-script runs an authoritative pre-commit check. Closes #2797
1 parent dc93e9a commit 6eda2da

2 files changed

Lines changed: 19 additions & 0 deletions

File tree

internal/scaffold/fullsend-repo/scripts/post-retro-test.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ done
3737
3838
echo "gh $*" >> "${GH_LOG}"
3939
40+
# Label creation calls — succeed silently (mimics --force behavior).
41+
if [[ "$1" == "label" && "$2" == "create" ]]; then
42+
exit 0
43+
fi
44+
4045
# Issue creation calls — return a fake issue URL.
4146
if [[ "$1" == "issue" && "$2" == "create" ]]; then
4247
echo "https://github.com/test-org/target-repo/issues/99"
@@ -219,6 +224,11 @@ run_test "happy-path-triage-label" \
219224
"${FIXTURE_ONE_PROPOSAL}" \
220225
"ready-for-triage"
221226

227+
# Verify that gh label create is called before gh issue create.
228+
run_test "label-created-before-issue" \
229+
"${FIXTURE_ONE_PROPOSAL}" \
230+
"gh label create ready-for-triage"
231+
222232
# Happy path: no proposals, comment posted successfully.
223233
run_test "happy-path-no-proposals" \
224234
"${FIXTURE_NO_PROPOSALS}" \

internal/scaffold/fullsend-repo/scripts/post-retro.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,15 @@ for i in $(seq 0 $((PROPOSAL_COUNT - 1))); do
9393
echo "::warning::proposal[$i] targets a .fullsend repo (${TARGET_REPO}). Filing in .fullsend repos is discouraged until per-repo customization patterns are stable. Consider filing in the source repo or fullsend-ai/fullsend upstream instead."
9494
fi
9595

96+
# Ensure the label exists in the target repo before applying it.
97+
# Follows the same pattern as post-review.sh for ready-for-merge.
98+
# --force makes this idempotent (no error if the label already exists).
99+
gh label create "ready-for-triage" \
100+
--repo "${TARGET_REPO}" \
101+
--description "Retro-filed issue awaiting triage agent" \
102+
--color "ededed" \
103+
--force 2>/dev/null || true
104+
96105
echo "Filing issue in ${TARGET_REPO}: ${TITLE}"
97106
if ! ISSUE_URL=$(gh issue create \
98107
--repo "${TARGET_REPO}" \

0 commit comments

Comments
 (0)