fix: intercept duplicate workflow execution from automated tag pushes#10
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR closes #9 resolving an issue in our release pipeline where merging into
mainfires the📦 Packaging, Signed Release & Container Publishingjob twice for the same commit. The initial run successfully packages the assets and creates the tag, while the second run consistently fails out on our organization's asset immutability checks.🕵️♂️ Root Cause Analysis
release.ymlworkflow triggers on both pushes tomainand pushes matching version tags (v*).main, the pipeline compiles and callssoftprops/action-gh-release@v2usingsecrets.MCP_PAT. Because this Personal Access Token belongs to an external service account (mcpwest) rather than the defaultGITHUB_TOKEN, GitHub's native workflow loop prevention is bypassed. The automated creation of the release tag triggers the workflow a second time.♻️ Deleting previously uploaded asset...). Because theDigitalServerHostorganization enforces immutable release rules, the GitHub API rejects the deletion with a validation error, forcing a red pipeline run despite the artifacts already being securely deployed.🛠️ Changes Implemented
if:) on the packaging and release job to explicitly evaluate the event actor.mcpwestservice account.westkevin12orgatchimuchio) and standard merges tomainwill continue to trigger releases normally.📝 Workflow Changes
name: "📦 Packaging, Signed Release & Container Publishing" needs: quality-gates - if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')) + if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || (startsWith(github.ref, 'refs/tags/v') && github.actor != 'mcpwest')) runs-on: ubuntu-latestVerification Logs
mainpush workflow run still retains all proper execution properties.