Skip to content

Fix changeset.js to prompt for confirmation before modifying files#1549

Merged
pelikhan merged 2 commits intomainfrom
copilot/ensure-confirmation-before-file-change
Oct 11, 2025
Merged

Fix changeset.js to prompt for confirmation before modifying files#1549
pelikhan merged 2 commits intomainfrom
copilot/ensure-confirmation-before-file-change

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Oct 11, 2025

Problem

The changeset.js release command was asking for user confirmation after already modifying files. This created a poor user experience where canceling the release left the repository in a modified state requiring manual cleanup.

The problematic flow was:

  1. Update CHANGELOG.md ❌ (file modified)
  2. Delete changeset files ❌ (files deleted)
  3. Ask "Proceed with git operations?" ⚠️ (too late!)
  4. If user cancels: files already changed, showing message "CHANGELOG.md has been updated but no git operations were performed"

Solution

Moved the confirmation prompt to happen before any file modifications. Now users can safely cancel without leaving the repository in a modified state.

The corrected flow is:

  1. Show release preview (version, changes to be included)
  2. Ask "Proceed with creating the release?" ✓ (happens first)
  3. If user cancels: exit cleanly with "No changes have been made"
  4. If user confirms: update CHANGELOG.md, delete changesets, commit, tag, push

Changes

  • Moved promptConfirmation() call to execute before updateChangelog() and deleteChangesetFiles()
  • Updated confirmation message to: "Proceed with creating the release (update files, commit, tag, and push)?"
  • Updated cancellation message to: "Release cancelled. No changes have been made."

Testing

Verified the order of operations using automated testing to ensure confirmation now happens at line 41 of the runRelease() function, before file modifications at lines 49 and 52.

Impact

This is a minimal change (9 insertions, 10 deletions) that significantly improves the user experience by ensuring confirmation happens before any destructive operations. No breaking changes to functionality.

Original prompt

Review changeset.js and make sure confirmation happens before changing files.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Move the confirmation prompt to happen before updateChangelog() and deleteChangesetFiles() are called. Previously, files were modified before asking for user confirmation, which meant canceling would leave the repository in a modified state. Now, if the user cancels, no files are changed.

Changes:
- Moved promptConfirmation() call before file modifications
- Updated confirmation message to reflect all operations
- Updated cancellation message to accurately state "No changes have been made"

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Ensure confirmation occurs before changing files in changeset.js Fix changeset.js to prompt for confirmation before modifying files Oct 11, 2025
Copilot AI requested a review from pelikhan October 11, 2025 16:28
@pelikhan pelikhan marked this pull request as ready for review October 11, 2025 16:32
@pelikhan pelikhan merged commit af6b712 into main Oct 11, 2025
6 checks passed
@pelikhan pelikhan deleted the copilot/ensure-confirmation-before-file-change branch October 11, 2025 16:32
@github-actions
Copy link
Copy Markdown
Contributor

Agentic Changeset Generator triggered by this pull request

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.

2 participants