41 lines
1.2 KiB
YAML
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
|