Skip to content

Add propose script#2462

Merged
porter-stripe merged 4 commits into
masterfrom
tyler/propose-script
May 20, 2026
Merged

Add propose script#2462
porter-stripe merged 4 commits into
masterfrom
tyler/propose-script

Conversation

@tjclawson-stripe
Copy link
Copy Markdown
Collaborator

@tjclawson-stripe tjclawson-stripe commented May 13, 2026

Summary

Add propose script to automatically generate proposal PR

  • propose.rb takes version option (major, minor, patch) and update package.json accordingly
  • propose.rb will not create a git tag
  • publish.rb no longer bumps version but creates and pushes git tag
  • npm publish now runs on master branch

Motivation

  • Prevent accidentally publishing wrong version
  • Ensures package.json version is correct and merged to master
  • PCI compliance

Testing

  • I tested this manually
  • I added automated tests

Documentation

Select one:

  • I have added relevant documentation for my changes.
  • This PR does not result in any developer-facing changes.

@tjclawson-stripe tjclawson-stripe requested review from a team as code owners May 13, 2026 23:08
Copy link
Copy Markdown
Collaborator

@porter-stripe porter-stripe left a comment

Choose a reason for hiding this comment

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

few comments

Comment thread scripts/propose.rb
execute_or_fail("yarn version --no-git-tag-version --new-version #{version}")
end

def create_proposal_pr(version)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can we add a check that the users tree is not dirty? If a user has uncommitted changes, git checkout -b will carry them into the new branch, and they'll get committed along with the version bump

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Updated

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Added helper.rb to re-use preflight checks for both scripts

Comment thread scripts/propose.rb
bump_version(version)
update_changelog(version)

execute_or_fail("git add package.json CHANGELOG.md")
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Probably fine, but are we sure no files will ever need to be included?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I can't think of any reason we'd add other files, but if we need to in the future it's probably best to be explicit instead of add .

Comment thread scripts/propose.rb
BODY

puts ""
pr_url = `hub pull-request --base master --head #{branch} -F #{pr_message_file.shellescape}`.strip
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think hub is deprecated in favor of GitHub CLI (gh)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Comment thread scripts/publish.rb

def current_branch
@branch_name || `git rev-parse --abbrev-ref HEAD`.strip
def create_git_tag
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

If someone re-runs publish.rb after a partial failure, git tag will fail because the tag already exists. Can we handle this gracefully?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

They should be able to re-run from the step that failed, meaning this will be skipped if e.g. publish is what failed

Comment thread scripts/publish.rb Outdated
end

current_version = version_and_date.split(" -").first.strip
current_ver = version_and_date.split(" -").first.strip
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nit can we keep this name current_version.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Removed to just call the current_version helper method instead

Comment thread scripts/publish.rb Outdated
JSON.parse(File.read("package.json"))["version"]
end

def ensure_on_master
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

is this ever called?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Called in preflight_checks which has been moved to helpers.rb

@porter-stripe porter-stripe merged commit 6656be3 into master May 20, 2026
9 checks passed
@porter-stripe porter-stripe deleted the tyler/propose-script branch May 20, 2026 18:15
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