Skip to content

P0: Add workflow_dispatch to release workflow + manual rerun support#32

Merged
Kinin-Code-Offical merged 1 commit intomainfrom
p0/release-workflow-dispatch
Dec 21, 2025
Merged

P0: Add workflow_dispatch to release workflow + manual rerun support#32
Kinin-Code-Offical merged 1 commit intomainfrom
p0/release-workflow-dispatch

Conversation

@Kinin-Code-Offical
Copy link
Owner

@Kinin-Code-Offical Kinin-Code-Offical commented Dec 21, 2025

Closes #15

Summary:

  • Add workflow_dispatch to the release workflow with a required tag input.
  • Resolve a single RELEASE_TAG for checkout, version check, asset deletion, and release upload.

Tests:

  • npm ci (PASS)
  • npm run lint (PASS)
  • npm test (PASS)
  • npm run build (PASS)
  • npm run package (PASS)
  • npm run smoke:exe (PASS)
  • npm run installer (PASS)
  • npm run stage (PASS)

Rollback:

  • Revert this commit to remove manual release dispatch support.

Summary by Sourcery

CI:

  • Add workflow_dispatch trigger with a required tag input to the release workflow and allow the release job to run for both manual and tag push events.

Copilot AI review requested due to automatic review settings December 21, 2025 23:43
@sourcery-ai
Copy link

sourcery-ai bot commented Dec 21, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adds manual dispatch support to the release GitHub Actions workflow and centralizes tag handling via a RELEASE_TAG environment variable used consistently across checkout, version validation, asset cleanup, and release creation.

Sequence diagram for manual workflow_dispatch release trigger

sequenceDiagram
    actor Developer
    participant GitHub_UI
    participant GitHub_Actions as GitHub_Actions_Workflow_Engine
    participant Release_Workflow as release_yml
    participant Runner as Actions_Runner
    participant GH_API as GitHub_Releases_API

    Developer->>GitHub_UI: Configure workflow_dispatch input tag (vX.Y.Z)
    Developer->>GitHub_UI: Click Run workflow
    GitHub_UI-->>GitHub_Actions: workflow_dispatch event with input tag

    GitHub_Actions->>Release_Workflow: Start job release
    Release_Workflow->>Runner: Set env.RELEASE_TAG = inputs.tag

    Runner->>Runner: actions/checkout@v4 with ref = env.RELEASE_TAG

    Runner->>Runner: Check Version
    Runner->>Runner: Set PowerShell variable tag = RELEASE_TAG -replace '^v', ''
    Runner->>Runner: Compare package.json version to tag

    Runner->>GH_API: List existing release assets using RELEASE_TAG
    GH_API-->>Runner: Existing assets (if any)
    Runner->>Runner: Delete matching assets

    Runner->>GH_API: softprops/action-gh-release@v2
    Note over Runner,GH_API: if github.event_name == workflow_dispatch
    Runner->>GH_API: Create or update release
    Runner->>GH_API: Use tag_name = env.RELEASE_TAG and upload artifacts
    GH_API-->>Runner: Release and asset upload result
Loading

File-Level Changes

Change Details Files
Add workflow_dispatch trigger with required tag input and centralize release tag resolution via RELEASE_TAG for all release steps.
  • Add workflow_dispatch trigger with a required string input tag for manually running the release workflow.
  • Introduce a job-level RELEASE_TAG environment variable that resolves to the manual input tag for workflow_dispatch runs or falls back to github.ref_name for tag pushes.
  • Update the checkout step to explicitly check out the ref specified by RELEASE_TAG instead of the default ref.
  • Change the PowerShell version check script to derive the version from RELEASE_TAG by stripping a leading v rather than parsing GITHUB_REF.
  • Update the asset deletion script to use RELEASE_TAG as the tag value instead of deriving it from GITHUB_REF.
  • Relax the release job condition to run for both workflow_dispatch and tag pushes, and explicitly pass tag_name: RELEASE_TAG to softprops/action-gh-release.
.github/workflows/release.yml

Assessment against linked issues

Issue Objective Addressed Explanation
#15 Add a workflow_dispatch trigger with an input tag to the release GitHub Actions workflow so it can be run manually.
#15 Support manual reruns by resolving a single RELEASE_TAG value (from either workflow_dispatch input or the pushed tag) and using it consistently for checkout, version validation, asset deletion, and release creation/upload.

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • In the job-level env you reference inputs.tag, but for workflow_dispatch inputs you should use github.event.inputs.tag (e.g., RELEASE_TAG: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.tag || github.ref_name }}), otherwise the manual runs won’t get the intended tag.
  • Since workflow_dispatch relies on a free-form tag input, consider adding a small validation step (e.g., ensure it starts with v and corresponds to an existing tag) to fail fast with a clear error before checkout or release logic runs.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In the job-level `env` you reference `inputs.tag`, but for `workflow_dispatch` inputs you should use `github.event.inputs.tag` (e.g., `RELEASE_TAG: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.tag || github.ref_name }}`), otherwise the manual runs won’t get the intended tag.
- Since `workflow_dispatch` relies on a free-form `tag` input, consider adding a small validation step (e.g., ensure it starts with `v` and corresponds to an existing tag) to fail fast with a clear error before checkout or release logic runs.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@Kinin-Code-Offical Kinin-Code-Offical merged commit aabdad3 into main Dec 21, 2025
10 checks passed
@Kinin-Code-Offical Kinin-Code-Offical deleted the p0/release-workflow-dispatch branch December 21, 2025 23:45
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds support for manually triggering the release workflow via workflow_dispatch with a specified tag, allowing releases to be rerun for an existing tag. The changes introduce a unified RELEASE_TAG variable to handle both automatic tag pushes and manual dispatches.

Key changes:

  • Added workflow_dispatch trigger with a required tag input parameter
  • Introduced RELEASE_TAG environment variable that resolves to either the manual input tag or the pushed tag
  • Updated all tag references throughout the workflow to use RELEASE_TAG

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

- name: Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
if: ${{ github.event_name == 'workflow_dispatch' || startsWith(github.ref, 'refs/tags/') }}
Copy link

Copilot AI Dec 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The conditional expression syntax is incorrect. In GitHub Actions workflow files, the 'if' condition should not be wrapped in double curly braces with a dollar sign. Remove the '${{ }}' wrapper and use just the expression.

The correct syntax should be: if: github.event_name == 'workflow_dispatch' || startsWith(github.ref, 'refs/tags/')

Suggested change
if: ${{ github.event_name == 'workflow_dispatch' || startsWith(github.ref, 'refs/tags/') }}
if: github.event_name == 'workflow_dispatch' || startsWith(github.ref, 'refs/tags/')

Copilot uses AI. Check for mistakes.
steps:
- uses: actions/checkout@v4
with:
ref: ${{ env.RELEASE_TAG }}
Copy link

Copilot AI Dec 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The RELEASE_TAG environment variable cannot be referenced in the checkout step because job-level environment variables are not available to the 'with' context of actions. GitHub Actions evaluates the 'with' parameters before environment variables are set. This will cause the checkout to fail when triggered via workflow_dispatch.

To fix this, you need to resolve the tag directly in the 'with' context using the same conditional logic, or set up a separate step to determine the tag and use step outputs.

Suggested change
ref: ${{ env.RELEASE_TAG }}
ref: ${{ github.event_name == 'workflow_dispatch' && inputs.tag || github.ref_name }}

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

P0: Add workflow_dispatch to release workflow + manual rerun support

1 participant