feat: better securing release workflows and github actions#482
Conversation
📝 WalkthroughWalkthroughThis PR adds environment deployments and ref validation to two marketplace publish workflows. The stable publish job is restricted to the ChangesMarketplace Publish Environment and Ref Validation
Estimated Code Review Effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
.github/workflows/marketplace-publish.yml (1)
40-49:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winAdd version/tag safety for
workflow_dispatchpublishes
Validate release tagonly runs onpushevents (if: github.event_name == 'push'), soworkflow_dispatchskips any tag/version validation. While manual publishes are restricted to run frommain(Validate publish ref, lines 33-38), the workflow still readssrc/package.json’s version and creates/updates a GitHub release forv${package_version}(lines 102-133) without preventing prerelease versions (e.g.,-beta,-rc) from being treated as “stable”.Add the same prerelease/stable-format check for
workflow_dispatch(or document that prerelease versions are intentionally allowed for manual stable publishes).🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In @.github/workflows/marketplace-publish.yml around lines 40 - 49, The current "Validate release tag" step only runs for push events and never validates manual workflow_dispatch publishes or blocks prerelease versions; update its condition to run for both push and workflow_dispatch (e.g., check github.event_name for push OR workflow_dispatch) and extend the logic that reads package_version/tag_version to also validate prerelease format: when running under workflow_dispatch ensure package_version does not contain prerelease identifiers (e.g., a hyphen like "-beta" or "-rc") or otherwise enforce the same tag_version match rules used for push; adjust the step that later creates/updates the release (which uses v${package_version}) to rely on this validation so prerelease versions cannot be promoted as stable unless explicitly allowed/documented.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In @.github/workflows/marketplace-publish.yml:
- Around line 40-49: The current "Validate release tag" step only runs for push
events and never validates manual workflow_dispatch publishes or blocks
prerelease versions; update its condition to run for both push and
workflow_dispatch (e.g., check github.event_name for push OR workflow_dispatch)
and extend the logic that reads package_version/tag_version to also validate
prerelease format: when running under workflow_dispatch ensure package_version
does not contain prerelease identifiers (e.g., a hyphen like "-beta" or "-rc")
or otherwise enforce the same tag_version match rules used for push; adjust the
step that later creates/updates the release (which uses v${package_version}) to
rely on this validation so prerelease versions cannot be promoted as stable
unless explicitly allowed/documented.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 1c9f8cdd-7180-4f36-82f6-1480c577a719
📒 Files selected for processing (2)
.github/workflows/marketplace-publish.yml.github/workflows/nightly-publish.yml
Related GitHub Issue
Closes: #
Description
Adds GitHub environment references and ref guards to the release publish workflows so marketplace credentials are exposed through narrower, auditable release paths.
Key changes:
marketplace-productionenvironment.marketplace-prereleaseenvironment.main.main, preventing manual dispatch from arbitrary feature branches.The intended live GitHub environment setup is:
marketplace-production: required reviewer gate for stable marketplace publishing.marketplace-prerelease: no required reviewer gate, preserving automatic pre-release publishing from protectedmain.Test Procedure
git diff --check.marketplace-productionwith theAdminsteam as required reviewers.marketplace-prereleasewith no required reviewers.Pre-Submission Checklist
Screenshots / Videos
N/A
Documentation Updates
Additional Notes
After this merges, move marketplace publish tokens into environment-scoped secrets:
VSCE_PATandOVSX_PATintomarketplace-production.VSCE_PATinmarketplace-prerelease.Get in Touch
Summary by CodeRabbit