christiangoeschel b345768781
Some checks failed
Pull Request Checks / commit-message-check (pull_request) Successful in 4s
Pull Request Checks / linting (pull_request) Successful in 46s
Post PR Merge Action / integrate (push) Failing after 5s
feat(ci): Add commit message format and squash commit checks
2025-02-12 07:47:32 -05:00

41 lines
1.2 KiB
YAML

name: Pull Request Checks
run-name: ${{ gitea.actor }} is building ${{ gitea.repository }} 🚀
on:
pull_request:
branches: [main]
jobs:
commit-message-check:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Verify if commits are squashed
run: |
commit_count=$(wc -l <(git log --pretty=%s HEAD ^origin/main) | awk -F' ' '{print $1}')
echo "[INFO] Number of commits for this PR: ${commit_count}"
if (( ${commit_count} != 1 )); then
echo "[ERROR] The commits are not squashed. Please run 'git rebase -i HEAD~${commit_count}' on your local repository."
echo "Then squash the most recent commits, keep the first one and finally 'git push -f'."
exit 1
else
echo "[INFO] Commits are squashed, good!"
fi
- name: Check commit message format
uses: ./.gitea/actions/commit-msg-check
linting:
runs-on: ubuntu-latest
needs: [commit-message-check]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Lint static source files
uses: ./.gitea/actions/pre-commit-linter