Code Monkey home page Code Monkey logo

cocogitto-action's Introduction

Cocogitto github action

This action uses cocogitto to check your repository is conventional commit and perform auto-release.

Requirement

  1. Before running this action you need to call checkout action with fetch-depth: 0. This is mandatory, otherwise not all commit will be fetched and cocogitto will fail to execute (see actions/checkout for more info).

  2. Cocogitto assumes you are running on a x86 linux runner.

Example

on: [push]

jobs:
  cog_check_job:
    runs-on: ubuntu-latest
    name: check conventional commit compliance
    steps:
      - uses: actions/checkout@v2
        with:
          fetch-depth: 0

      - name: Conventional commit check
        uses: oknozor/cocogitto-action@v1

If you are familiar with cocogitto this will run cog check and nothing else.

Check commits since latest tag

In some case you might want to perform check only since the latest tagged version. If your repository has not always been conventional commits compliant, then you probably want to use this option.

      - name: Conventional commit check
        uses: oknozor/cocogitto-action@v1
        with:
          check-latest-tag-only: true

Let us assume the following git history :

* 9b609bc - (HEAD -> main) WIP: feat unfinished work
* d832ca4 - feat: working on feature A
* d5ce110 - (tag: 0.1.0) chore: release 0.1.0
* 8f25a4b - chore: a commit before tag 0.1.0

Using check-latest-tag-only: true here would make cocogitto check for the two commits made since tag 0.1.0, the action would fail on HEAD which contains the non-conventional commit type 'WIP'.

Performing release

You can also use this action to perform releases (calling cog bump --auto under the hood) (see: cocogitto's auto bump).

      - name: Semver release
        uses: oknozor/cocogitto-action@v1
        id: release
        with:
          release: true
          git-user: 'Cog Bot'
          git-user-email: '[email protected]'

      # The version number is accessible as a github action output
      - name: Print version
        run: "echo '${{ steps.release.outputs.version }}'"

Note that you probably want to set the git-user and git-user-email options to override the default the git signature for the release commit. If you are not familiar with how cocogitto perform release, you might want to read the auto bump and hook sections on cocogitto's documentation.

Post step run

Once the step is finished cocogitto's binary will be available in your path.

Reference

Here are all the inputs available through with:

Input Description Default
check Check conventional commit compliance with cog check true
check-latest-tag-only Check conventional commit compliance with cog check --from-latest-tag false
release Perform a release using cog bump --auto false
git-user Set the git user.name to use for the release commit cog-bot
git-user-email Set the git user.email to use for the release commit [email protected]

cocogitto-action's People

Contributors

oknozor avatar

Watchers

 avatar

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.