Skip to content

Add ref_name input to beta and production deploy workflows#2681

Merged
piyalbasu merged 2 commits intomasterfrom
deploy-branch-for-releases
Apr 4, 2026
Merged

Add ref_name input to beta and production deploy workflows#2681
piyalbasu merged 2 commits intomasterfrom
deploy-branch-for-releases

Conversation

@piyalbasu
Copy link
Copy Markdown
Contributor

@piyalbasu piyalbasu commented Apr 4, 2026

  • Fix ref_name description in submitProduction.yml (was "defaults to master", now "defaults to the selected branch or tag")
  • Remove env-file injection risk: replace echo REF_NAME=... >> $GITHUB_ENV with inline GitHub expression in actions/checkout ref field (both workflows)
  • Add target_commitish (checked-out SHA via git rev-parse HEAD) to actions/create-release@v1 in both workflows to ensure releases point to the correct commit

Allow deploying from a specific branch, tag, or commit SHA
instead of being locked to release/<version> (beta) or master (production).
Follows the same pattern used in freighter-mobile's ios.yml.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 4, 2026 00:43
Copy link
Copy Markdown
Contributor

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 updates the manual beta and production deployment workflows to allow checking out and deploying from an explicitly provided git ref (branch/tag/commit SHA) rather than always using a fixed branch pattern.

Changes:

  • Add a ref_name workflow_dispatch input to both beta and production workflows.
  • Add a “Set ref” step and use it to drive actions/checkout’s ref.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.

File Description
.github/workflows/submitProduction.yml Adds ref_name input and uses it to check out a chosen ref for production deploys.
.github/workflows/submitBeta.yml Adds ref_name input and uses it to check out a chosen ref for beta deploys.

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

Comment on lines +36 to +46
- name: Set ref
run: |
if [[ "${{ github.event.inputs.ref_name }}" != "" ]]; then
echo "REF_NAME=${{ github.event.inputs.ref_name }}" >> $GITHUB_ENV
else
echo "REF_NAME=release/${{ github.event.inputs.release }}" >> $GITHUB_ENV
fi
- name: Checkout code
uses: actions/checkout@v6
with:
ref: release/${{ github.event.inputs.release }}
ref: ${{ env.REF_NAME }}
Copy link

Copilot AI Apr 4, 2026

Choose a reason for hiding this comment

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

Since this workflow can now check out a custom ref_name, the GitHub Release tag should be created against that same commit. actions/create-release@v1 will create the tag on the default branch unless target_commitish is provided, so beta releases may end up pointing at the wrong code when ref_name (or release/<release>) is checked out. Set target_commitish to the checked-out SHA/ref when creating the release.

Copilot uses AI. Check for mistakes.
@piyalbasu
Copy link
Copy Markdown
Contributor Author

@copilot apply changes based on the comments in this thread

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 4, 2026

@copilot apply changes based on the comments in this thread

Applied all changes from that review thread in commit 7bfb516:

  1. Fixed ref_name description in submitProduction.yml — now reads "defaults to the selected branch or tag" instead of "defaults to master".
  2. Eliminated env-file injection risk — removed the Set ref steps that used echo "REF_NAME=${{ github.event.inputs.ref_name }}" >> $GITHUB_ENV (vulnerable to newline injection). The user-provided ref is now passed directly via a GitHub expression in the actions/checkout ref field in both workflows.
  3. Added target_commitish to actions/create-release@v1 in both workflows — a new "Get checkout SHA" step captures git rev-parse HEAD after checkout and passes that SHA as target_commitish, ensuring releases always point to the correct checked-out commit regardless of the ref used.

Copy link
Copy Markdown
Contributor

@CassioMG CassioMG left a comment

Choose a reason for hiding this comment

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

LGTM

@piyalbasu piyalbasu merged commit de61521 into master Apr 4, 2026
6 checks passed
@piyalbasu piyalbasu deleted the deploy-branch-for-releases branch April 4, 2026 00:56
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.

4 participants