Coder Social home page Coder Social logo

Comments (3)

thekevinscott avatar thekevinscott commented on August 16, 2024 1

I think the formatting of the if statement may have changed; in my shared workflow definition, I had to format the if statement like:

    if: ${{ ! startsWith(github.event.head_commit.message, '[skip-version]') }}

Just in case anyone else stumbles along here!

from gh-action-bump-version.

nickbeaulieu avatar nickbeaulieu commented on August 16, 2024

Yes, it's true that running the action always bumps the version. If not specified it will increment the patch version.

You could create an if condition for the workflow (or even just the Bump package version step). For example, to base the condition on having a certain string in the commit message you can use a condition like this.

jobs:
  version-bump:
    if: "startsWith(github.event.head_commit.message, 'VERSION BUMP:')"

If you more frequently wish to bump the version than not bump the version, you could invert the condition to prevent it.

jobs:
  version-bump:
    if: "!startsWith(github.event.head_commit.message, 'NO BUMP:')"

These conditions are just examples.

As a real world example, our workflow creates an rc version bump by default, not a patch. To achieve that we used the following settings.

...
with:
  # These words need to be part of a commit to trigger
  # They are purposefully complex to avoid accidental triggers
  major-wording: 'major-bb-protected'
  minor-wording: 'minor-bb-protected'
  patch-wording: 'patch-bb-protected'
  # needs to be empty for all pushes to be prerelease
  rc-wording: ''

  # defaulting to bump prerelease version--default is patch
  default: prerelease
  preid: 'rc'

  tag-prefix: 'v'

  target-branch: 'main'
  commit-message: 'CI: bumps version to {{version}}'

from gh-action-bump-version.

a-Leong avatar a-Leong commented on August 16, 2024

Another option is to include [ci skip] in the commit message, from Github Docs. Note that this will skip all action workflows that would otherwise be triggered by the commit.

from gh-action-bump-version.

Related Issues (20)

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.