From 7d8049eb700d654cb84c52b51f28557714b2c66c Mon Sep 17 00:00:00 2001 From: joengy Date: Thu, 9 Apr 2026 16:30:59 +1200 Subject: [PATCH 1/3] Add root .gitignore to exclude .vscode/ --- .gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1d74e21 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.vscode/ From 216e9ef9ad3d89f74a928679b0f4c75799158477 Mon Sep 17 00:00:00 2001 From: joengy Date: Thu, 9 Apr 2026 16:35:12 +1200 Subject: [PATCH 2/3] chore: add PR template and branch/commit validation to CI --- .github/pull_request_template.md | 16 ++++++++++++++ .github/workflows/ci.yml | 36 ++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 .github/pull_request_template.md diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000..470fc14 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,16 @@ +## What does this PR do? + + + +## Type of change + +- [ ] Feature +- [ ] Bug fix +- [ ] Chore / config +- [ ] Hotfix + +## Checklist + +- [ ] My branch follows the naming convention (`feature/`, `fix/`, `chore/`, `hotfix/`) +- [ ] My commit messages follow the conventional commits format +- [ ] CI checks pass diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 835dc0c..29f8e3f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,6 +6,42 @@ on: branches: [main] jobs: + validate: + name: Validate branch & commits + runs-on: ubuntu-latest + if: github.event_name == 'pull_request' + steps: + - name: Check branch name + run: | + BRANCH="${{ github.head_ref }}" + if ! echo "$BRANCH" | grep -qE '^(feature|fix|chore|hotfix)/.+'; then + echo "Branch name '$BRANCH' does not follow the naming convention." + echo "Expected: feature/, fix/, chore/, or hotfix/ prefix" + exit 1 + fi + + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Check commit messages + run: | + COMMITS=$(git log origin/${{ github.base_ref }}..HEAD --format="%s") + PATTERN="^(feat|fix|chore|hotfix|docs|refactor|test|style|ci)(\(.+\))?: .+" + FAILED=0 + while IFS= read -r msg; do + if ! echo "$msg" | grep -qE "$PATTERN"; then + echo "Invalid commit message: '$msg'" + FAILED=1 + fi + done <<< "$COMMITS" + if [ $FAILED -eq 1 ]; then + echo "" + echo "Commit messages must follow: type(scope): description" + echo "Valid types: feat, fix, chore, hotfix, docs, refactor, test, style, ci" + exit 1 + fi + web: name: Web runs-on: ubuntu-latest From 3de4a8036bb7e19b94c60de61d5d3408cc0156e6 Mon Sep 17 00:00:00 2001 From: joengy Date: Thu, 9 Apr 2026 16:40:47 +1200 Subject: [PATCH 3/3] fix: skip merge commits in commit message validation --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 29f8e3f..3224d11 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,10 +26,11 @@ jobs: - name: Check commit messages run: | - COMMITS=$(git log origin/${{ github.base_ref }}..HEAD --format="%s") + COMMITS=$(git log origin/${{ github.base_ref }}..HEAD --format="%s" --no-merges) PATTERN="^(feat|fix|chore|hotfix|docs|refactor|test|style|ci)(\(.+\))?: .+" FAILED=0 while IFS= read -r msg; do + if [ -z "$msg" ]; then continue; fi if ! echo "$msg" | grep -qE "$PATTERN"; then echo "Invalid commit message: '$msg'" FAILED=1