Marketplace-ready GitHub Action for validating Co-authored-by trailers with coauthorcheck.
This repository is meant to be published separately from the main coauthorcheck Python package repo because GitHub Marketplace actions work best from a dedicated public repository with a root action.yml.
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Validate branch commits
uses: simoncraf/coauthorcheck-action@v0.1.0
with:
package-version: "0.6.0"
range: origin/main..HEADrange: required git revision range to validateconfig: optional config file pathformat: optional output format,textorjsonpython-version: optional Python version used inside the actionpackage-version: optional PyPI package version to installworking-directory: optional working directory for runningcoauthorcheckcomment-on-pr: optional, set totrueto create or update a PR commentcomment-mode: optional,failures-onlyoralwaysdelete-comment-on-success: optional, delete the existing PR comment after a successful rungithub-token: optional token for PR comment operationscomment-header: optional markdown heading for the PR comment
When comment-on-pr is enabled, the action forces JSON internally even if format: text is requested.
status:pass,fail, orerrorexit-code: rawcoauthorcheckexit codeissue-count: total validation issue countinvalid-commit-count: number of commits with issueswarning-count: total warning countcomment-action:created,updated,deleted, ornone
Validate commits introduced by a pull request:
name: Validate Co-authored-by trailers on PR
on:
pull_request:
branches:
- main
jobs:
validate-commits:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Validate PR commits
uses: simoncraf/coauthorcheck-action@v0.1.0
with:
package-version: "0.6.0"
range: origin/${{ github.base_ref }}..HEAD
comment-on-pr: "true"
comment-mode: failures-onlyValidate commits introduced by branch pushes:
name: Validate Co-authored-by trailers
on:
push:
branches:
- "feature/**"
- "feat/**"
jobs:
validate-commits:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Validate branch commits
uses: simoncraf/coauthorcheck-action@v0.1.0
with:
package-version: "0.6.0"
range: origin/main..HEADThe action uses a single hidden marker to manage one PR comment:
<!-- coauthorcheck-comment -->Behavior:
- validation failures create or update the managed comment
- successful runs delete the managed comment when
delete-comment-on-successistrue - comment operations on non-PR events are skipped with a workflow warning
contents: readpull-requests: writewhencomment-on-pr: "true"