mirror of
https://github.com/super-linter/super-linter.git
synced 2024-11-29 20:20:57 -05:00
5d6e3fcecc
Add support to run Commitlint against commit messages. It supports the current modes: - Lint the commit message of the last commit - Lint the commit messages of the pushed commits in case there is more than one pushed commit This commit also removes stuff that we used to run commitlint as a standalone tool because we can now use the commitlint instance that Super-linter ships: - lint-commit steps in lint-commit the GitHub Actions workflow - lint-commit Make target - commitlint and its dependencies in package.json and package-lock.json
37 lines
893 B
YAML
37 lines
893 B
YAML
---
|
|
name: Lint commit
|
|
|
|
on:
|
|
push:
|
|
pull_request:
|
|
merge_group:
|
|
|
|
# Don't grant any access by default
|
|
permissions: {}
|
|
|
|
jobs:
|
|
commitlint:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Check if the pull request contains a single commit
|
|
if: github.event_name == 'pull_request'
|
|
run: |
|
|
commit_count=${{ github.event.pull_request.commits }}
|
|
|
|
if [ -z ${commit_count} ]; then
|
|
echo "[ERROR] commit_count is empty"
|
|
exit 1
|
|
fi
|
|
|
|
if [[ ${commit_count} -ne 1 ]]; then
|
|
echo "[ERROR] This pull request contains ${commit_count} commits. Squash these commits into a single commit."
|
|
exit 1
|
|
else
|
|
echo "This pull request contains ${commit_count} commit."
|
|
fi
|