Skip to content

create-release-pr: Add create-release-pr reusable workflow#20

Merged
linhcrl merged 1 commit intomainfrom
version-bump-workflow
Apr 7, 2026
Merged

create-release-pr: Add create-release-pr reusable workflow#20
linhcrl merged 1 commit intomainfrom
version-bump-workflow

Conversation

@linhcrl
Copy link
Copy Markdown
Contributor

@linhcrl linhcrl commented Mar 30, 2026

Automates creation of release pull requests by detecting unreleased changes in CHANGELOG.md, determining the next semantic version, updating the changelog with the release date, and creating a PR from a fork to the upstream repository.

Supports configurable release dates, custom git identity, and optional update scripts for projects that maintain version numbers in multiple files.

Updates release-version-extract action to expose unreleased_changes output, making changelog entries available for use in commit messages and PR bodies.

Co-Authored-By: roachdev-claude roachdev-claude-bot@cockroachlabs.com

@linhcrl linhcrl force-pushed the version-bump-workflow branch 3 times, most recently from 60d920f to a74cd2c Compare March 31, 2026 07:31
@linhcrl linhcrl changed the title Add version-bump reusable workflow version-bump: Add version-bump reusable workflow Mar 31, 2026
@linhcrl linhcrl requested a review from fantapop March 31, 2026 07:47
@fantapop fantapop requested a review from Copilot March 31, 2026 20:17
@linhcrl linhcrl force-pushed the version-bump-workflow branch 2 times, most recently from d46ea87 to 4744110 Compare March 31, 2026 20:21
Copy link
Copy Markdown

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

Adds a new reusable GitHub workflow to automate version bump PR creation, and extends the existing release-version-extract action to expose unreleased changelog text for use in commit messages and PR bodies.

Changes:

  • Add .github/workflows/version-bump.yml reusable workflow to generate a version bump branch/commit and open a PR from a fork.
  • Extend release-version-extract to output unreleased_changes and document the new output in README.md.
  • Update docs/changelog and bump the actions/checkout version used in the repo test workflow.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
release-version-extract/action.yml Exposes unreleased_changes output from the changelog reader step.
README.md Documents unreleased_changes, adds docs for get-workflow-ref, and documents the new version-bump workflow.
CHANGELOG.md Notes the addition of the new version-bump reusable workflow.
.github/workflows/version-bump.yml New reusable workflow implementing the version bump PR automation.
.github/workflows/test.yml Updates the checkout action version used in CI.
Comments suppressed due to low confidence (2)

.github/workflows/version-bump.yml:221

  • The PR body is built with a double-quoted Bash string that directly interpolates steps.extract-version.outputs.unreleased_changes. Changelog content containing quotes/newlines/$()/backticks can break the assignment or trigger shell expansion. Prefer constructing the body using a quoted heredoc (no interpolation) and/or pass the changelog content through an env var to avoid evaluation.
    CHANGELOG.md:23
  • This changelog entry refers to “CHANGELOG” (no extension) while the rest of the repo/docs consistently use CHANGELOG.md. Consider standardizing the filename here to avoid confusion.
### Changed

- `autotag-from-changelog` action: now automatically creates and updates major
  version tags (e.g., `v1`) when pushing semver tags (e.g., `v1.2.3`), allowing

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

@linhcrl linhcrl force-pushed the version-bump-workflow branch 3 times, most recently from 40eab2b to eb76833 Compare March 31, 2026 20:52
@linhcrl linhcrl changed the title version-bump: Add version-bump reusable workflow create-release-pr: Add create-release-pr reusable workflow Mar 31, 2026
@linhcrl linhcrl force-pushed the version-bump-workflow branch 5 times, most recently from 18a7fdc to cdfb6a1 Compare April 3, 2026 21:48
@linhcrl linhcrl requested a review from fantapop April 3, 2026 21:50
Copy link
Copy Markdown
Contributor

@fantapop fantapop left a comment

Choose a reason for hiding this comment

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

I didn't quite finish but left some feedback

@linhcrl linhcrl force-pushed the version-bump-workflow branch 7 times, most recently from ea56bad to d852544 Compare April 5, 2026 06:07
@linhcrl linhcrl force-pushed the version-bump-workflow branch 3 times, most recently from 1fa2373 to 79f2591 Compare April 5, 2026 06:41
Copy link
Copy Markdown
Contributor

@fantapop fantapop left a comment

Choose a reason for hiding this comment

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

This is looking really close. I left some nits and one regarding expect_diff.

Comment on lines +151 to +160
test_get_base_branch_gh_failure() {
# Test in a directory that's not a git repo - gh should fail
(
cd "$TMPDIR_TEST"
local result
result=$(get_base_branch "" "owner/repo" 2>&1)
echo "$result" | check_contains "main"
)
}
expect_success "get_base_branch: falls back to main when gh fails" test_get_base_branch_gh_failure
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is this the the desired behavior? It seems like we might actually just want to fail out.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Updated this to fail, good catch

Comment on lines +155 to +156
echo "$output" | check_contains "File not found"
echo "$output" | check_contains "missing_file.txt"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

is there more we can match on here to make it clear it's a warning ? i.e. check_contains_pattern "Warning.*missing_file.txt"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Updated

test_helpers.sh Outdated
Comment on lines +179 to +180
# Check if diff contains the expected string (exact match, not regex)
if echo "$actual_diff" | check_contains "$expected_diff"; then
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Are you not worried this guarantee will be too weak? It means the diff could contain extra unexpected stuff but the test would still pass. If you were worried about the readability of including the additional lines you could dial down the diff context to 1 or even 0 to achieve the same effect but with the added bonus it would fail if there were extra things in the diff.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I updated the test helper to accept the full expected diff and updated the function to check for exact match

@linhcrl linhcrl force-pushed the version-bump-workflow branch from 79f2591 to c894223 Compare April 7, 2026 05:10
@linhcrl linhcrl requested a review from fantapop April 7, 2026 15:02
}

# Assert that input contains a given substring.
# Usage: check_contains "expected" "$file" (reads file)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Side note, the file reading part of this function seems odd. I went and looked at existing usages of it and it seems like it's for checking that the GITHUB_OUTPUT has the string in it. Almost all of our usages if check_contains are checking to see if a string has another string. I don't think we should change it for this PR but maybe something to consider for a future change.

@linhcrl linhcrl force-pushed the version-bump-workflow branch from c894223 to 23c6384 Compare April 7, 2026 17:44
@linhcrl linhcrl requested a review from fantapop April 7, 2026 17:45
@linhcrl
Copy link
Copy Markdown
Contributor Author

linhcrl commented Apr 7, 2026

@fantapop Updated the test helper to fail if the diff contains two hunks since in our current use cases, we are only expecting one

Automates creation of release pull requests by detecting unreleased
changes in CHANGELOG.md, determining the next semantic version, updating
the changelog with the release date, and creating a PR from a fork to
the upstream repository.

Supports optional build scripts for projects that maintain version
numbers in multiple files.

Updates release-version-extract action to expose unreleased_changes
output, making changelog entries available for use in commit messages
and PR bodies.

Co-Authored-By: roachdev-claude <roachdev-claude-bot@cockroachlabs.com>
@linhcrl linhcrl force-pushed the version-bump-workflow branch from 23c6384 to fe1dd13 Compare April 7, 2026 18:23
Copy link
Copy Markdown
Contributor

@fantapop fantapop left a comment

Choose a reason for hiding this comment

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

Nice. Looks sweet!

@linhcrl linhcrl merged commit 4ea9194 into main Apr 7, 2026
2 checks passed
@linhcrl linhcrl deleted the version-bump-workflow branch April 7, 2026 19:10
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.

3 participants