Skip to content

haproxytech/check-commit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

126 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Check if commit subject is compliant with HAProxy guidelines

Contributors License

This action checks that the commit subject is compliant with the patch classifying rules of HAProxy contribution guidelines. Also it does minimal check for a meaningful message in the commit subject: no less than 20 characters and at least 3 words.

Examples

Good

  • Bug fix:
BUG/MEDIUM: fix set-var parsing bug in config-parser
  • New minor feature:
MINOR: Add path-rewrite annotation
  • Minor build update:
BUILD/MINOR: Add path-rewrite annotation

Bad

  • Incorrect patch type
bug: fix set-var parsing bug in config-parser
  • Short commit message
BUG/MEDIUM: fix set-var
  • Unknown severity
BUG/MODERATE: fix set-var parsing bug in config-parser

Inputs

None.

Usage

steps:
  - name: check-commit
    uses: docker://ghcr.io/haproxytech/commit-check:TAG
    env:
      API_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Check-commit works only on pull_request events by inspecting all commit messages in a Pull Request.

Commit data source

Commits and diffs are read from the local git clone when possible (GitHub, GitLab and local runs alike), which enables attributing file spelling errors to the commit that introduced them. For this to work in CI the clone needs enough history — use fetch-depth: 0 with actions/checkout (GitHub) or GIT_DEPTH: "0" (GitLab).

When the clone is missing or too shallow, check-commit falls back to the pull requests API / GitLab merge requests API (set API_TOKEN). If the API is also unavailable, the checks are skipped with a warning: the run stays green and the junit report contains a commit checks skipped entry whose body carries the error detail.

Example configuration

If a configuration file (.check-commit.yml) is not available in the running directory, a built-in failsafe configuration identical to the one below is used.

---
HelpText: "Please refer to https://github.com/haproxy/haproxy/blob/master/CONTRIBUTING#L632"
PatchScopes:
  HAProxy Standard Scope:
    - MINOR
    - MEDIUM
    - MAJOR
    - CRITICAL
PatchTypes:
  HAProxy Standard Patch:
    Values:
      - BUG
      - BUILD
      - CLEANUP
      - DOC
      - LICENSE
      - OPTIM
      - RELEASE
      - REORG
      - TEST
      - REVERT
    Scope: HAProxy Standard Scope
  HAProxy Standard Feature Commit:
    Values:
      - MINOR
      - MEDIUM
      - MAJOR
      - CRITICAL
TagOrder:
  - PatchTypes:
    - HAProxy Standard Patch
    - HAProxy Standard Feature Commit

Optional parameters

The program accepts an optional parameter to specify the location (path) of the base of the git repository. This can be useful in certain cases where the checked-out repo is in a non-standard location within the CI environment, compared to the running path from which the check-commit binary is being invoked.

aspell

to check also spellcheck errors aspell was added. it can be configured with .aspell.yml

example

mode: subject
min_length: 3
ignore_files:
  - go.mod
  - go.sum
  - '*test.go'
  - 'gen/*'
allowed:
  - aspell
  - config

min_length is minimal word size that is checked (default: 3)

mode can be set as

  • subject
    • default option
    • only subject of commit message will be checked
  • commit
    • whole commit message will be checked
  • all
    • both commit message and all code committed
  • disabled
    • check is disabled

About

HAProxy git commit message validator

Resources

License

Stars

0 stars

Watchers

7 watching

Forks

Packages

 
 
 

Contributors

Languages