diff --git a/.github/workflows/build-release-task.yml b/.github/workflows/build-release-task.yml index f82538cc..93bdf032 100644 --- a/.github/workflows/build-release-task.yml +++ b/.github/workflows/build-release-task.yml @@ -223,10 +223,12 @@ jobs: # Surgical cleanup at the point of consumption: the release-asset--* transfer artifacts now have durable # copies on the release, so delete them by exact pattern to free the storage quota - scoped to this branch's - # assets, leaving diagnostics and any other artifacts. A job that fails before this leaves its artifacts for the - # retention-days: 1 backstop. Needs the caller to grant `actions: write` (publish-release's publish job does). + # assets, leaving diagnostics and any other artifacts. Gated to the same condition as the create step so it only + # deletes when a release was actually created/refreshed this run; on a skipped create (existing tag, no new + # commits) the fresh artifacts stay for the run, reaped by the retention-days: 1 backstop. Needs the caller to + # grant `actions: write` (publish-release's publish job does). - name: Delete consumed release asset artifacts step - if: ${{ inputs.expect_release_assets }} + if: ${{ inputs.expect_release_assets && (steps.release-exists.outputs.exists == 'false' || github.event_name == 'workflow_dispatch') }} # Best-effort: the release is already published, so a listing/delete hiccup must never red the job; the # retention-days: 1 backstop reaps anything missed. Deletes every matching id (a rerun can upload duplicates). continue-on-error: true