Skip to content

Latest commit

 

History

History
186 lines (130 loc) · 7.82 KB

File metadata and controls

186 lines (130 loc) · 7.82 KB

Commit-Check GitHub Action

Commit Check GitHub release (latest SemVer) Used by GitHub marketplace slsa-badge

A GitHub Action for checking commit message formatting, branch naming, committer name, email, commit signoff, and more.

What's New?

Important

Version: v2.0.02025-10-20

This release introduces several breaking changes. Please review the Breaking Changes section before upgrading.

Breaking Changes

  • Dropped support for commit-signoff, merge-base, and imperative inputs which are moved to new config file commit-check.toml.
  • Dropped support for .commit-check.yml in favor of commit-check.toml.
  • Changed default values of author-name and author-email inputs to false to align with commit-check default configuration.
  • Updated core dependency commit-check to v2.0.0.

More details can be found in the release notes.

Table of Contents

Usage

Create a new GitHub Actions workflow in your project, e.g. at .github/workflows/commit-check.yml

name: Commit Check

on:
  push:
  pull_request:
    branches: 'main'

jobs:
  commit-check:
    runs-on: ubuntu-latest
    permissions:  # use permissions because use of pr-comments
      contents: read
      pull-requests: write
    steps:
      - uses: actions/checkout@v5
        with:
          ref: ${{ github.event.pull_request.head.sha }}  # Checkout PR HEAD commit
          fetch-depth: 0  # Required for merge-base checks
      - uses: commit-check/commit-check-action@v2
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed for PR comments
        with:
          message: true
          branch: true
          author-name: false
          author-email: false
          job-summary: true
          pr-comments: ${{ github.event_name == 'pull_request' }}

Used By

Apache Apache   discovery-unicamp discovery-unicamp   Texas Instruments Texas Instruments   OpenCADC OpenCADC   Extrawest Extrawest Chainlift Chainlift   Mila Mila   RLinf RLinf   and many more.

Optional Inputs

message

branch

author-name

  • Description: check committer author name.
  • Default: false

author-email

  • Description: check committer author email.
  • Default: false

dry-run

  • Description: run checks without failing. exit code is 0; otherwise is 1.
  • Default: false

job-summary

  • Description: display job summary to the workflow run.
  • Default: true

pr-comments

  • Description: post results to the pull request comments.
  • Default: false

Important

pr-comments is an experimental feature. By default, it's disabled. To use it, you need to set GITHUB_TOKEN in the GitHub Action.

This feature currently doesn’t work with forked repositories. For more details, refer to issue #77.

Note: the default rule of above inputs is following this configuration. If you want to customize, just add your commit-check.toml config file under your repository root directory.

GitHub Action Job Summary

By default, commit-check-action results are shown on the job summary page of the workflow.

Success Job Summary

Success job summary

Failure Job Summary

Failure job summary

GitHub Pull Request Comments

Success Pull Request Comment

Success pull request comment

Failure Pull Request Comment

Failure pull request comment

Badging Your Repository

You can add a badge to your repository to show your contributors/users that you use commit-check!

Commit Check

Markdown

[![Commit Check](https://github.com/commit-check/commit-check-action/actions/workflows/commit-check.yml/badge.svg)](https://github.com/commit-check/commit-check-action/actions/workflows/commit-check.yml)

reStructuredText

.. image:: https://github.com/commit-check/commit-check-action/actions/workflows/commit-check.yml/badge.svg
    :target: https://github.com/commit-check/commit-check-action/actions/workflows/commit-check.yml
    :alt: Commit Check

Versioning

Versioning follows Semantic Versioning.

Have questions or feedback?

To provide feedback (requesting a feature or reporting a bug), please post to issues.