Skip to content

build-release-task: surgical artifact delete runs even when the release create/refresh step is skipped #217

Closed

Description

@ptr727

Summary

In build-release-task.yml the github-release job's two paired steps use mismatched conditions:

  • Create GitHub release step — if: ${{ steps.release-exists.outputs.exists == 'false' || github.event_name == 'workflow_dispatch' }}
  • Delete consumed release asset artifacts step — if: ${{ inputs.expect_release_assets }}

On a scheduled run where the release tag already exists and there are no new commits, the create step is skipped (release exists, not a dispatch), but build-nugetlibrary still uploaded the release-asset-<branch>-* artifacts, and the delete step still removes them — even though nothing was published or refreshed this run.

Impact

Low but real: the delete step's stated intent is "the transfer artifacts now have durable copies on the release, so delete them." When the create step is skipped, that premise doesn't hold for this run — the freshly built artifact was never attached to a release this run. The durable copy on the pre-existing release is from the original creation, and the upload carries retention-days: 1, so nothing is permanently lost; but the fresh artifact is removed immediately instead of being available for the run's lifetime (e.g. to inspect an unexpected rebuild).

Proposed fix

Gate the delete step on the same condition as the create step, so it only runs when a release was actually created/refreshed this run; otherwise let retention-days: 1 reap the artifacts:

      - name: Delete consumed release asset artifacts step
        if: ${{ inputs.expect_release_assets && (steps.release-exists.outputs.exists == 'false' || github.event_name == 'workflow_dispatch') }}

(Both steps are in the same github-release job, so steps.release-exists.outputs.exists is in scope for the delete step.)

Context

Found via Copilot review during the downstream re-sync of #213/#214. Reporting upstream rather than diverging locally; will pull the fix down on the next template re-sync.

Activity

  1. added a commit that references this issue on Jun 26, 2026
    8d508ce
  2. ptr727 commented on Jun 26, 2026

    @ptr727
    OwnerAuthor

    Fixed on develop via #218 (8d508ce): the delete step now gates on the same exists=='false' || workflow_dispatch condition as the create step, so a scheduled re-run on an existing tag no longer deletes the freshly built artifacts. Ships on the next develop → main release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions