GitHub Actions does not respect [skip ci]

Hi Github,

adding to the list of missing features/docs outlined in https://github.community/t5/GitHub-Actions/Matrix-testing-stops-service-containers/m-p/42827, I want to add that “[skip ci]”, which is respected by most CI solutions out there, is straight up ignored by GitHub.

So someone at github, please add this feature!

72 Likes

In the meantime I am using this: 

if: "! contains(toJSON(github.event.commits.*.msg), '[skip-ci]')"

Though I haven’t tested it yet. I am assuming it will work based on the documentation alone. 

13 Likes

Please add “[skip CI]” etc. to GitHub Actions.

Sometimes, for trivial commits, we don’t want to set off a load of build runners. 

I’m only using the GitHub Actions for open source where it’s free, but I would be annoyed to be required to use so many up.

Actually, I did recently create a private repo for testing security fixes for a projects, and it used up about 300 minutes per build (Linux and Mac, had to disable Windows as too expensive), and quickly burnt through the 2,000 minutes quota in just a few builds.

One project uses GitHub Actions, Travis CI and Appveyor. It looks quite silly when we use “[CI skip]” and Travis and Appveyor respect it, but there are 33 GitHub jobs!

Further, it’s bad for the environment to wastefully use server time.

Many other CIs let us skip builds:

Travis CI

The command should be one of the following forms:

[<KEYWORD> skip]

or

[skip <KEYWORD>]

where <KEYWORD> is either ci, travis, travis ci, travis-ci, or travisci.

https://docs.travis-ci.com/user/customizing-the-build#skipping-a-build

AppVeyor

Add [skip ci] or [ci skip] to commit message title and build won’t be triggered by AppVeyor for that commit. Or explicitly skip AppVeyor only with [skip appveyor] and still allow any other CI to build the commit (eg. Travis CI).

https://www.appveyor.com/docs/how-to/filtering-commits/#skip-directive-in-commit-message

CircleCI

By default, CircleCI automatically builds a project whenever you push changes to a version control system (VCS). You can override this behavior by adding a [ci skip] or [skip ci] tag anywhere in a commit’s title or description. 

GitLab

If your commit message contains [ci skip] or [skip ci], using any capitalization, the commit will be created but the pipeline will be skipped.

https://docs.gitlab.com/ee/ci/yaml/#skipping-jobs

Semaphore CI

If you’d like your commit, or a series of commits that you’re pushing, to not trigger a build, just write [ci skip] or [skip ci] somewhere in your commit’s message.

https://semaphoreci.com/docs/how-to-skip-building-for-some-commits-with-ci-skip.html

Bitbucket Pipelines

If you don’t want to run a pipeline on a commit that would normally trigger one, you can include [skip ci] or [ci skip] anywhere in your commit message of the HEAD commit. Any commits that include [skip ci] or [ci skip] in the message are ignored by Pipelines.

https://confluence.atlassian.com/bitbucket/bitbucket-pipelines-faq-827104769.html

23 Likes

We would definitely use this. Especially if the action updates the code and pushes it, this is critical to avoid infinite loops

3 Likes

Also would appreciate this feature

I too need this :slight_smile:

@
AndreaGriffiths11Any comments about this?

Thank you for your answer! 

You must use ‘message’ instead of ‘msg’ in order to make it work:

if: "! contains(toJSON(github.event.commits.*.message), '[skip-ci]')"
8 Likes

Here’s an example:

name: my CI github action

on:
  push:
    branches:
      - master

jobs:
  build:
    if: "!contains(github.event.head_commit.message, 'skip ci')"
    runs-on: ubuntu-latest

if the commit message contains “skip ci” it will, guess what, skip the CI action :smiley:

8 Likes

This is definitely something that is needed…please add! Tools like lerna that publish form CI often push a commit that you can format with [ci-skip]. This is commonly supported in other CI pipelines and without will trigger a recursive build. The options listed below aren’t great because a job / multiple jobs will actually start and show logging in the Actions console until they determine they are supposed to be skipped.

Definitely needed.

FWIW in the meantime we’ve had success with this:

steps:
      - name: Checkout repo
        uses: actions/checkout@v2
      - name: Check last commit message
        id: skip
        uses: atlwendy/retrieve-commit-messages-from-pr@v2
      - name: Set SHOULD_RUN flag
        run: echo ::set-env name=SHOULD_RUN::${{ steps.skip.outputs.shouldRun }}
      - name: Set up Node
        uses: actions/setup-node@v1
        if: env.SHOULD_RUN == 'true'
...etc

That custom action will output theshouldRun value which will be true if skip ci or ci skip is found in the last commit message on the PR.

2 Likes

:+1: Would be really nice to have this out of the box.

1 Like