How conjikidow/bump-version works
Project type and purpose
• This is a GitHub Action (“Bump Version by Labels”) designed to run in the GitHub Actions environment.
• Purpose: Automatically bump the semantic version of a project based on pull-request labels, open a version-bump PR, and, once merged, push new Git tags.
File structure
• Top-level:
• .bumpversion.toml – configuration for bump-my-version
• action.yaml – GitHub Action metadata (inputs, outputs, entrypoint)
• README.md, LICENSE
• .github/ folder:
• workflows/ci.yaml, bump-version.yaml, etc. – CI definitions and test workflows
• labels/ & related files – label definitions for automatic PR labeling
• src/ folder:
• determine-bump-type.sh – reads PR labels, decides bump type (major/minor/patch)
• bump-version.sh – invokes bump-my-version to update files
• create-tag.sh – after merge, parses branch name and pushes Git tags
README for additional insights
• Triggers on pull_request.closed when PR is merged.
• Uses GitHub API to read labels, create branches, open PRs, write tags.
• Delegates version file updates to bump-my-version.
• Enforces semantic versioning rules and manages major/minor/patch tags.
Main components & their interactions
a. GitHub Events (pull_request.closed)
b. GitHub Actions Runner
c. Entry point (action.yaml)
d. Shell scripts in src/:
• -bump-type.sh
• bump-version.sh
• create-tag.sh
e. External tool: bump-my-version
f. GitHub API for branch creation, PR creation, tag pushes
g. Configuration file: .bumpversion.toml
h. Git repository (files to be updated/tagged)
Interaction flow:
1. GitHub Event → triggers Action on the runner
2. Runner loads inputs from action.yaml and .bumpversion.toml
3. determine-bump-type.sh calls GitHub API to list PR labels → decides bump type
4. bump-version.sh invokes bump-my-version → updates version in target files
5. If version changed, script uses Git + GitHub API → creates new branch + opens version-bump PR
6. On merge, runner invokes create-tag.sh → extracts version, calls GitHub API → pushes vX.Y.Z, vX.Y, vX tags
Architectural patterns & principles
• Event-driven workflow (trigger/respond)
• Single Responsibility: each script has one clear task
• Configuration-driven (semantic version rules via .bumpversion.toml)
• API-driven integration with GitHub
• Idempotent operations: skip if no matching labels or if bump not needed
1. “GitHub Event: pull_request.closed (merged)” at the top.
a. -bump-type.sh → GitHub API (List labels) → Bump type decision
b. bump-version.sh → bump-my-version → modifies version files → Git commit → GitHub API (create branch + PR)
c. create-tag.sh (triggered on PR merge) → extract version → GitHub API (push tags)
4. .bumpversion.toml file feeding configuration into the bump-version step.
5. Git repository as storage for version-controlled files and tags.