Skip to content

Commit fe9b16b

Browse files
anujhydrabadiclaude
andcommitted
Cleanup: delete only the preview doc via --stage PREVIEW
Live testing showed `raptor delete iac-module REF --yes --force` deletes the PUBLISHED doc when a module has both published and preview versions — so cleanup on an in-place-update PR would delete the customer's live module. Delete now uses `raptor delete iac-module REF --stage PREVIEW --yes`, which targets only the preview doc (and errors if no preview exists). Dropped --force so the usage guard stays active and a genuinely in-use preview surfaces as a real error instead of being force-deleted; that failure is already recorded and gates the job. README version requirement updated to list --stage alongside --feature-branch and list-JSON provenance. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 1ec4c1c commit fe9b16b

2 files changed

Lines changed: 18 additions & 8 deletions

File tree

module-ci-action/README.md

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,19 @@ modules live at `infra/modules/...`).
4141
## Requirements
4242

4343
- **Runner:** Ubuntu (the action installs a Linux amd64 `raptor` binary).
44-
- **raptor version:** the **preview** mode uses `raptor create iac-module --feature-branch`,
45-
a flag that marks a preview as **unpublishable**. It is newer than the base
46-
`iac-module` commands, so preview mode requires a `raptor` release that ships
47-
`--feature-branch` and surfaces module git provenance (`gitRef` / `previewGitRef`) in
48-
`raptor get iac-module -o json`, which cleanup's ownership check reads. Pin
49-
`raptor_version` accordingly if `latest` ever lags. Publish works on any recent
50-
`raptor`; cleanup safely no-ops when those provenance fields are absent.
44+
- **raptor version:** preview and cleanup depend on newer `raptor` capabilities:
45+
- **preview** uses `raptor create iac-module --feature-branch`, a flag that marks a
46+
preview as **unpublishable**.
47+
- **cleanup** reads module git provenance (`gitRef` / `previewGitRef`) from
48+
`raptor get iac-module -o json` for its ownership check, and deletes with
49+
`raptor delete iac-module --stage PREVIEW`, which targets **only** the preview doc
50+
(so a module that has both a published and a preview version never loses its live
51+
published doc).
52+
53+
These require a `raptor` release that ships all three (`--feature-branch`, row-level
54+
provenance in the list JSON, and `delete --stage`). Pin `raptor_version` if `latest`
55+
ever lags. Publish works on any recent `raptor`; cleanup safely no-ops when the
56+
provenance fields are absent.
5157

5258
## Inputs
5359

module-ci-action/action.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,11 @@ runs:
381381
fi
382382
383383
echo "Deleting preview for ${REF} (owned by this PR, owning commit=${OWNER_SHA})..."
384-
if ! raptor delete iac-module "$REF" --yes --force; then
384+
# --stage PREVIEW targets ONLY the preview doc; without it a REF that has
385+
# both a published and a preview doc would delete the live published
386+
# module. Keep the usage guard (no --force) so a genuinely in-use preview
387+
# surfaces as a real error rather than being force-deleted.
388+
if ! raptor delete iac-module "$REF" --stage PREVIEW --yes; then
385389
echo "::error::Failed to delete preview for ${REF}"
386390
echo "${REF} (cleanup)" >> "$FAILURES"
387391
fi

0 commit comments

Comments
 (0)