Skip to content

Add workflow to bump version and create pull request#7

Merged
IvanMurzak merged 1 commit intomainfrom
IvanMurzak-patch-1
Mar 4, 2026
Merged

Add workflow to bump version and create pull request#7
IvanMurzak merged 1 commit intomainfrom
IvanMurzak-patch-1

Conversation

@IvanMurzak
Copy link
Copy Markdown
Owner

This pull request adds a new GitHub Actions workflow to automate the process of bumping the project version. The workflow allows maintainers to manually trigger a version bump, validates the version format, creates a release branch, runs a version update script, and opens a pull request with the changes.

Automation for version bumping:

  • Added a new workflow file .github/workflows/bump_version.yml that enables maintainers to manually trigger a version bump via workflow dispatch, validates the version input, creates a release branch, runs the bump-version.ps1 script, commits and pushes the changes, and automatically opens a pull request for the version bump.

@IvanMurzak IvanMurzak self-assigned this Mar 4, 2026
Copilot AI review requested due to automatic review settings March 4, 2026 05:23
@IvanMurzak IvanMurzak added the enhancement New feature or request label Mar 4, 2026
@IvanMurzak IvanMurzak merged commit 4c2c05f into main Mar 4, 2026
19 checks passed
@IvanMurzak IvanMurzak deleted the IvanMurzak-patch-1 branch March 4, 2026 05:24
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 manually-triggered GitHub Actions workflow to automate version bumping by creating a release branch, running the existing PowerShell bump script, committing/pushing changes, and opening a PR.

Changes:

  • Introduces .github/workflows/bump_version.yml workflow_dispatch input for a target version.
  • Validates the version input, creates a release/<version> branch, runs commands/bump-version.ps1, commits/pushes, and creates a PR via gh.

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

Comment on lines +11 to +14
jobs:
bump-version:
runs-on: ubuntu-latest
steps:
Copy link

Copilot AI Mar 4, 2026

Choose a reason for hiding this comment

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

The workflow doesn’t declare permissions, so git push and/or gh pr create may fail in repos where the default GITHUB_TOKEN permissions are read-only. Add explicit permissions (at workflow or job level) for contents: write and pull-requests: write (and keep other scopes minimal).

Copilot uses AI. Check for mistakes.
Comment on lines +16 to +19
run: |
if ! [[ "${{ github.event.inputs.version }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Error: version must be in X.X.X format (got: ${{ github.event.inputs.version }})"
exit 1
Copy link

Copilot AI Mar 4, 2026

Choose a reason for hiding this comment

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

The version validation regex only allows X.Y.Z, but commands/bump-version.ps1 accepts full semver including pre-release/build metadata (e.g. 1.2.3-rc.1, 1.2.3+build.5). Align the workflow validation with the script’s Test-SemanticVersion pattern, or intentionally restrict inputs and update the script/description accordingly.

Copilot uses AI. Check for mistakes.
Comment on lines +29 to +30
git config user.name "IvanMurzak"
git config user.email "Ivan.D.Murzak@gmail.com"
Copy link

Copilot AI Mar 4, 2026

Choose a reason for hiding this comment

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

This hard-codes a personal name/email for commits made by the workflow, which can be misleading for auditability and may expose personal contact info in git history. Consider using the standard github-actions[bot] identity (or ${{ github.actor }} where appropriate) and a no-reply email.

Suggested change
git config user.name "IvanMurzak"
git config user.email "Ivan.D.Murzak@gmail.com"
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"

Copilot uses AI. Check for mistakes.
Comment on lines +37 to +43
- name: Commit and push version bump
run: |
git add -A
git commit -m "chore: bump version to ${{ github.event.inputs.version }}"
git push origin release/${{ github.event.inputs.version }}

- name: Create pull request
Copy link

Copilot AI Mar 4, 2026

Choose a reason for hiding this comment

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

commands/bump-version.ps1 can exit successfully without changing files (e.g. when the new version equals the current version), which will cause git commit to fail with “nothing to commit” and break the workflow. Add a conditional check for a dirty working tree (or git diff --quiet) and skip commit/push/PR creation when there are no changes.

Suggested change
- name: Commit and push version bump
run: |
git add -A
git commit -m "chore: bump version to ${{ github.event.inputs.version }}"
git push origin release/${{ github.event.inputs.version }}
- name: Create pull request
- name: Commit and push version bump
id: commit_version_bump
run: |
if git diff --quiet; then
echo "No changes detected after version bump; skipping commit and push."
echo "changes=false" >> "$GITHUB_OUTPUT"
exit 0
fi
git add -A
git commit -m "chore: bump version to ${{ github.event.inputs.version }}"
git push origin release/${{ github.event.inputs.version }}
echo "changes=true" >> "$GITHUB_OUTPUT"
- name: Create pull request
if: steps.commit_version_bump.outputs.changes == 'true'

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants