GistTree.Com
Entertainment at it's peak. The news is by your side.

Running GitHub Actions for Certain Commit Messages

0

A brief stare at the vogue you would possibly perhaps almost certainly perhaps configure your GitHub Actions workflows to easiest mosey when a definite phrase is present within the commit message.

Printed 1 day ago
|
Updated 1 day ago


Tooling

I’m going to be trusty with you inflamed by a 2d. I write a total lot of wip commits. These commits are most regularly little changes that I must push up to GitHub so that:

  1. I operate now now not lose issues if something else goes impolite and my backup hasn’t picked it up.
  2. If I’m in a position to now now not describe the alternate I in reality procure appropriate made.
  3. If I’m demonstrating something to someone on a pull-demand.

The ache is, my actions are setup to mosey on push, so each and each wip commit will get mosey via the CI route of, whether or now now not or now now not it is running exams, linting or formatting.

After doing some compare, I found a vogue of preventing these from running on each and each commit.

jobs: 
  format: 
    runs-on:  ubuntu-most trendy
    if:  "! contains(github.occasion.head_commit.message, 'wip')"

Now, at any time after I push a wip commit or any commit that contains the observe wip, it would possibly almost certainly perhaps almost certainly even be marked as skipped inner of GitHub actions.

It is most likely you’ll almost certainly perhaps additionally flip the good judgment and in all chance lift out something relish:

jobs: 
  format: 
    runs-on:  ubuntu-most trendy
    if:  "contains(github.occasion.head_commit.message, '[build]')"

Any commit that contains [build] will now trigger these jobs, the entirety else will likely be skipped.

It is most likely you’ll almost certainly perhaps thank me later! 😉

Read More

Leave A Reply

Your email address will not be published.