Giter Site home page Giter Site logo

haya14busa / action-bumpr Goto Github PK

View Code? Open in Web Editor NEW
81.0 6.0 24.0 63 KB

๐Ÿ’ฅ Bump semantic version tag on merging Pull Requests with specific lables.

Home Page: https://github.com/marketplace/actions/bumpr-bump-version-when-merging-pull-request-with-specific-labels

License: MIT License

Dockerfile 7.27% Shell 92.73%
github-actions

action-bumpr's Introduction

action-bumpr

action-bumpr bumps semantic version tag on merging Pull Requests with specific labels (bump:major,bump:minor,bump:patch).

action-bumpr image

Test reviewdog release GitHub release (latest SemVer) action-bumpr supported

example

Input

inputs:
  default_bump_level:
    description: "Default bump level if labels are not attached [major,minor,patch]. Do nothing if it's empty"
    required: false
  dry_run:
    description: "Do not actually tag next version if it's true"
    required: false
  github_token:
    description: 'GITHUB_TOKEN to list pull requests and create tags'
    default: '${{ github.token }}'
    required: true
  tag_as_user:
    description: "Name to use when creating tags"
    required: false
  tag_as_email:
    description: "Email address to use when creating tags"
    required: false
outputs:
  current_version:
    description: "current version"
  next_version:
    description: "next version"
  skip:
    description: "True if release is skipped. e.g. No labels attached to PR."
  message:
    description: "Tag message"

Usage

Simple

name: release
on:
  push:
    branches:
      - master
  pull_request:
    types:
      - labeled

jobs:
  release:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      # Bump version on merging Pull Requests with specific labels.
      # (bump:major,bump:minor,bump:patch)
      - uses: haya14busa/action-bumpr@v1

Integrate with other release related actions.

Integrate with haya14busa/action-update-semver to update major and minor tags on semantic version tag release (e.g. update v1 and v1.2 tag on v1.2.3 release).

name: release
on:
  push:
    branches:
      - master
    tags:
      - 'v*.*.*'
  pull_request:
    types:
      - labeled

jobs:
  release:
    if: github.event.action != 'labeled'
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      # Bump version on merging Pull Requests with specific labels.
      # (bump:major,bump:minor,bump:patch)
      - id: bumpr
        if: "!startsWith(github.ref, 'refs/tags/')"
        uses: haya14busa/action-bumpr@v1

      # Update corresponding major and minor tag.
      # e.g. Update v1 and v1.2 when releasing v1.2.3
      - uses: haya14busa/action-update-semver@v1
        if: "!steps.bumpr.outputs.skip"
        with:
          github_token: ${{ secrets.github_token }}
          tag: ${{ steps.bumpr.outputs.next_version }}
  release-check:
    if: github.event.action == 'labeled'
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Post bumpr status comment
        uses: haya14busa/action-bumpr@v1

Badge

[![action-bumpr supported](https://img.shields.io/badge/bumpr-supported-ff69b4?logo=github&link=https://github.com/haya14busa/action-bumpr)](https://github.com/haya14busa/action-bumpr)

Note

action-bumpr uses push on master 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.

action-bumpr's People

Contributors

github-actions[bot] avatar haya14busa avatar ihulsbus avatar jordemort avatar kurtmckee avatar meroje avatar nicgrayson avatar ozw-sei avatar pr1ntr avatar rickstaa avatar shmokmt avatar shogo82148 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

action-bumpr's Issues

bumpr getting GitHub API errors

starting today we've been seeing this error coming back from bumpr for some reason.

{
  "message": "Resource not accessible by integration",
  "documentation_url": "https://docs.github.com/rest/reference/issues#create-an-issue-comment"
}

This is causing our bump job to fail to post a comment on the issue with the new version.

Our release job is also getting a weird error I can't explain

jq: error (at <stdin>:4): Cannot index string with string "merge_commit_sha"

Any idea what is happening here? Our job has been working perfectly for two years now until today.

Cannot find next version.

here is the PR
image

core code:

name: Bump
on:
  push:
    # Use push on master 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.
    branches:
      - main
    tags:
      - 'v*.*.*'
  pull_request:
    types:
      - labeled

jobs:
  lint:
    uses: ./.github/workflows/lint.yml

  release:
    if: github.event.action != 'labeled'
    needs: lint
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      # Bump version on merging Pull Requests with specific labels.
      # (bump:major,bump:minor,bump:patch)
      - id: bumpr
        if: "!startsWith(github.ref, 'refs/tags/')"
        uses: haya14busa/action-bumpr@v1

      # Update corresponding major and minor tag.
      # e.g. Update v1 and v1.2 when releasing v1.2.3
      - uses: haya14busa/action-update-semver@v1
        if: '!steps.bumpr.outputs.skip'
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          tag: ${{ steps.bumpr.outputs.next_version }}

  release-check:
    if: github.event.action == 'labeled'
    needs: lint
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Post bumpr status comment
        uses: haya14busa/action-bumpr@v1

feature suggestion: add new inputs to customize labels

It would be great if we have parameters to customize the labels. This way, I wouldn't be limited to using "bump:patch," "bump:minor," and "bump:major." My suggestion is to create three new optional inputs: patch-label, minor-label, and major-label.

Latest version not working

Latest version throws following error:

 * [new tag]         v0.0.1     -> v0.0.1
/entrypoint.sh: line 146: can't create : nonexistent directory

This doesnt work:

echo "current_version=${CURRENT_VERSION}" >> "$GITHUB_OUTPUT"

Certain special characters are causing bumpr to fail

Hi there,

We're using action-bumpr in our application release process, but from time to time we encounter the following problem:

Bump patch version
To https://github.com/<REDACTED>/<REDACTED>.git
 * [new tag]         v0.0.5 -> v0.0.5
curl: (3) URL using bad/illegal format or missing URL
##[debug]Docker Action run completed with exit code 3
##[debug]Set output current_version = v0.0.4
##[debug]Set output next_version = v0.0.5
##[debug]Set output message = v0.0.5: PR #139
Error: Unable to process file command 'output' successfully.
Error: Invalid format '144 - Develop to Master'
##[debug]System.Exception: Invalid format '144 - Develop to Master'
##[debug]   at GitHub.Runner.Worker.EnvFileKeyValuePairs.GetEnumerator()+MoveNext()
##[debug]   at GitHub.Runner.Worker.SetOutputFileCommand.ProcessCommand(IExecutionContext context, String filePath, ContainerInfo container)
##[debug]   at GitHub.Runner.Worker.FileCommandManager.ProcessFiles(IExecutionContext context, ContainerInfo container)
##[debug]Finishing: Bump Version

We're not entirely sure what causes this problem and even with debug mode enabled it's not precisely clear why it's an invalid format and what a valid format is.

The closest we can figure is that anything other than alphanumeric characters and ' (quotes) in the last commit message causes it to throw an error.

Any help you could give on this would be greatly appreciated.

Thanks ๐Ÿ˜„

action runs under a different user

Hi, I am using the action in my workflow in a dry-run mode to just determine the next version that needs to be built.

- name: bump version
  id: bump
  uses: haya14busa/action-bumpr@v1
  with:
    default_bump_level: patch
    dry_run: true

Unfortunately as the action is docker based and the Dockerfile does not contain a USER directive, the action runs under UID 1000 (root).
This, for some reason seems to have as effect that all ownership of the .git folder change to UID 1000, causing my next action with git to fail:

- name: bump chart version
  run: |
    export chartVersion=$(cat Chart.yaml | grep '^version:' | awk '{ print $2 }')
    sed -i '/version:/ s/'${chartVersion}'/'${{ steps.bump.outputs.next_version }}'/' Chart.yaml
      
- name: commit bump
  run: |
    git add Chart.yaml
    git commit -m "bump chart version"
    git push

The commit bump task results in a error: insufficient permission for adding an object to repository database .git/objects

Would it be possible to change the action so it runs as a non-root user? Preferably UID 1001 as that is the default for the github runners?

user: runner
id: uid=1001(runner) gid=127(docker) groups=127(docker),4(adm),101(systemd-journal)

Support bumping via commit messages

Some of other release functions works in a way that if commit message includes #minor or #major it will bump the version. Would be cool to add that capability since it would be a hassle to add these labels to all of our existing repositories

Job failes on private repository

I was trying to use this action inside a private repository, but when executed I get this error:

Bump patch version
fatal: not a git repository (or any parent up to mount point /github)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

It should break after this point:
https://github.com/haya14busa/action-bumpr/blob/master/entrypoint.sh#L114

Maybe it is caused by the git fetch command because it doesn't find the repo.
Can ${{ secrets.GITHUB_TOKEN }} be used to solve the issue?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.