Skip to content

Instantly share code, notes, and snippets.

@matthiasbeyer
Created May 31, 2022 07:18
Show Gist options
  • Select an option

  • Save matthiasbeyer/0cea6298547f4f629f9cb624c639e6eb to your computer and use it in GitHub Desktop.

Select an option

Save matthiasbeyer/0cea6298547f4f629f9cb624c639e6eb to your computer and use it in GitHub Desktop.

Revisions

  1. matthiasbeyer created this gist May 31, 2022.
    31 changes: 31 additions & 0 deletions lint.yaml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,31 @@
    name: lint commit messages

    on:
    pull_request:

    jobs:
    commit-lint:
    runs-on: "ubuntu-latest"

    steps:
    - uses: actions/checkout@v3
    with:
    ref: ${{ github.even.pull_request.head.sha }} # Checkout pull request HEAD commit instead of merge commit
    fetch-depth: 0 # fetch complete history

    - uses: actions/setup-python@v3
    with:
    python-version: '3.10'

    - name: Install gitlint
    run: pip install gitlint

    - name: Run gitlint
    run: |
    if [[ -z "${GITHUB_BASE_REF}" ]]; then
    BASE=origin/master
    else
    BASE="${GITHUB_BASE_REF}"
    fi
    echo "Linting: ${BASE}..HEAD"
    gitlint --commits ${BASE}..HEAD