Idea: Conditional Job (ci skip / skip ci keyword)

Hello there, we’ve migrated our all CI jobs from self-hoted Jenkins to Github Actions.

It’s well-made, no server mainternance is required. awesome. 

It would be nice if Github Actions supports “conditional job”. This can be used for filtering build triggers.

I use semantic-release for automating npm package publish workflow.

It automatically publises package based on semantic commit messages.

For example, Pushing “fix(scope): fix unsafe property access” commit to master branch will trigger patch version bump and publish to npm repository. 

Problem is: semantic-release create a new commit that contains version change information (e.g. updated package.json file, updated CHANGELOG.md). This commit hasci skip keyword - To skip build triggers because it is not necessary. As you know, Many CI Services like Travis support this.

So - I propose two ideas:

  1. Support if directive  to Job Definition

Currently if directive is only supportd in step definition. This can be expanded to Job Definition.

To archive ci skip filtering, it can be used like this way:


name: CI

on: push

jobs:

  test:

    if: !github.commit\_message.contains("ci skip")

    # ...

  1. Support commit filtering in on directive

Another idea is expanding on directive like this way:


on:

  branches:

     - master

  commits:

    - '\*'

    - '!ci skip'

22 Likes

I was testing semantic release in the other day  and the action didnt run for the commit that added the CHANGELOG file as expected. Maybe GitHub Actions already doing this under the hood?

Interesting. Our actions did run after release. Can you share your actions yml?

Definitely want to +1 this. CircleCI has this built in by default if a commit includes “[skip ci]” anywhere in the commit message.

1 Like

We have an on: push: master.

For example if you git push with the GITHUB_ACTOR pseudo token, the Action wont trigger again on a push.

If you use a User Token for auth, it triggers the action again.

But I am also missing the CircleCI feature [skip ci] - +1 to add this to Github Actions pls :) 

See also: https://github.community/t5/GitHub-Actions/How-to-push-to-protected-branches-in-a-GitHub-Action/m-p/36156/highlight/true#M2461

9 Likes