Skip to content

Inetum Poland GitHub Actions `bumper` repository.

License

Notifications You must be signed in to change notification settings

Inetum-Poland/action-bumper

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

action-bumper

.github/workflows/pre_commit.yml .github/workflows/trufflehog.yaml

Original projects: action-bumpr, update-semver.

action-bumper bumps semantic version tag on merging Pull Requests with specific labels (bumper:major,bumper:minor,bumper:patch, bumper:none), and creates semver tags on tag push.

Important

This repository uses the Conventional Commits.

For more information please see the Conventional Commits documentation.

Important

This repository uses the pre-commit.

Please be respectful while contributing and after cloning this repo install the pre-commit hooks.

> pre-commit install --install-hooks -t pre-commit -t commit-msg

For more information please see the pre-commit documentation.

Input

Name Description Default Required
bump_default_level Default bump level if labels are not attached [major, minor, patch, none]. Do nothing if it's empty false
bump_fail_if_no_level Fail if no bump label is found false false
bump_include_v Include v prefix in tag true false
bump_latest Add latest tag false false
bump_major Label name for major bump (bumper:major) bumper:major false
bump_minor Label name for minor bump (bumper:minor) bumper:minor false
bump_none Label name for no bump (bumper:none) bumper:none false
bump_patch Label name for patch bump (bumper:patch) bumper:patch false
bump_semver Whether to updates major/minor release tags on a tag push. e.g. Update v1 and v1.2 tag when released v1.2.3 false false
bump_tag_as_email Email address to use when creating tags false
bump_tag_as_user Name to use when creating tags false
github_token GITHUB_TOKEN to list pull requests and create tags ${{ github.token }} true

Output

Name Description
current_version current version
next_version next version
skip True if release is skipped. e.g. No labels attached to PR.
message Tag message

Usage

on:
  push:
    branches:
      - main
  pull_request:
    branches:
      - main
    types:
      - labeled
      - unlabeled
      - opened
      - reopened
      - synchronize

permissions:
  pull-requests: write
  contents: write

jobs:
  tag_bumper:
    runs-on: ubuntu-latest
    env:
      INETUM_POLAND_ACTION_BUMPER_DEBUG: ${{ vars.INETUM_POLAND_ACTION_BUMPER_DEBUG }}
      INETUM_POLAND_ACTION_BUMPER_TRACE: ${{ vars.INETUM_POLAND_ACTION_BUMPER_TRACE }}
    steps:
      - uses: hmarr/debug-action@v3

      - uses: actions/checkout@v4

      - uses: jwalton/gh-find-current-pr@v1
        id: finder
        with:
          state: all

      - id: bumper
        uses: ./
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          bump_fail_if_no_level: true
          bump_semver: true
          bump_latest: true

      - uses: marocchino/sticky-pull-request-comment@v2
        if: always() && (steps.bumper.outputs.tag_status != null) && (steps.finder.outputs.pr != null)
        with:
          header: action-bumper
          number: ${{ steps.finder.outputs.pr }}
          message: ${{ steps.bumper.outputs.tag_status }}

Note

action-bumper uses push on main event to run workflow instead of pull_request closed (merged) event because github token doesn't have write permission for pull_request from fork repository.


Copyright (c) 2024 Inetum Poland.