From e5d9b1879395503adee50b47297a73b5454da548 Mon Sep 17 00:00:00 2001 From: Andrew Butler <1628649+AButler@users.noreply.github.com> Date: Mon, 2 Feb 2026 17:03:59 +0000 Subject: [PATCH 1/5] Tag the release before creating draft --- .github/workflows/release.yaml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index ebd3e05..5104b14 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -76,6 +76,20 @@ jobs: - name: Publish run: dotnet nuget push "*.nupkg" --api-key ${{ steps.login.outputs.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json working-directory: .nupkgs + + - name: Create tag + uses: actions/github-script@v8 + env: + TAG: v${{ needs.version.outputs.version_full }} + with: + script: | + const tag = process.env.TAG; + github.rest.git.createRef({ + owner: context.repo.owner, + repo: context.repo.repo, + ref: `refs/tags/${tag}`, + sha: context.sha + }) - name: Create GitHub release uses: ncipollo/release-action@v1 From 0b048e7c5809379fa2e971a510db108419e9c5e6 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 3 Feb 2026 11:18:42 +0000 Subject: [PATCH 2/5] Initial plan From 1d34e2501449d25e073f8c3629f79687a4ccf08e Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 3 Feb 2026 11:19:58 +0000 Subject: [PATCH 3/5] Add tag existence checking with SHA validation Co-authored-by: AButler <1628649+AButler@users.noreply.github.com> --- .github/workflows/release.yaml | 35 ++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 5104b14..402a4ce 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -84,12 +84,43 @@ jobs: with: script: | const tag = process.env.TAG; - github.rest.git.createRef({ + + // Check if tag already exists + let existingTag; + try { + existingTag = await github.rest.git.getRef({ + owner: context.repo.owner, + repo: context.repo.repo, + ref: `tags/${tag}` + }); + } catch (error) { + if (error.status === 404) { + // Tag doesn't exist, we can create it + existingTag = null; + } else { + throw error; + } + } + + if (existingTag) { + const existingSha = existingTag.data.object.sha; + if (existingSha === context.sha) { + console.log(`Tag ${tag} already exists with the same SHA (${context.sha}). Skipping tag creation.`); + return; + } else { + core.setFailed(`Tag ${tag} already exists with a different SHA. Existing: ${existingSha}, Current: ${context.sha}`); + return; + } + } + + // Create the tag + await github.rest.git.createRef({ owner: context.repo.owner, repo: context.repo.repo, ref: `refs/tags/${tag}`, sha: context.sha - }) + }); + console.log(`Tag ${tag} created successfully at ${context.sha}`); - name: Create GitHub release uses: ncipollo/release-action@v1 From aeee7ea5cd269f40797928185c40ede1aed178e6 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 3 Feb 2026 11:20:30 +0000 Subject: [PATCH 4/5] Remove trailing spaces from workflow file Co-authored-by: AButler <1628649+AButler@users.noreply.github.com> --- .github/workflows/release.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 402a4ce..d2e7680 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -76,7 +76,7 @@ jobs: - name: Publish run: dotnet nuget push "*.nupkg" --api-key ${{ steps.login.outputs.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json working-directory: .nupkgs - + - name: Create tag uses: actions/github-script@v8 env: @@ -84,7 +84,7 @@ jobs: with: script: | const tag = process.env.TAG; - + // Check if tag already exists let existingTag; try { @@ -101,7 +101,7 @@ jobs: throw error; } } - + if (existingTag) { const existingSha = existingTag.data.object.sha; if (existingSha === context.sha) { @@ -112,7 +112,7 @@ jobs: return; } } - + // Create the tag await github.rest.git.createRef({ owner: context.repo.owner, From e537759f1ee3fc0a27b16bd06f6b44c3bdc5b440 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 3 Feb 2026 11:21:00 +0000 Subject: [PATCH 5/5] Fix error handling to use throw instead of core.setFailed Co-authored-by: AButler <1628649+AButler@users.noreply.github.com> --- .github/workflows/release.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index d2e7680..579b5d4 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -108,8 +108,7 @@ jobs: console.log(`Tag ${tag} already exists with the same SHA (${context.sha}). Skipping tag creation.`); return; } else { - core.setFailed(`Tag ${tag} already exists with a different SHA. Existing: ${existingSha}, Current: ${context.sha}`); - return; + throw new Error(`Tag ${tag} already exists with a different SHA. Existing: ${existingSha}, Current: ${context.sha}`); } }