diff --git a/.githooks/commit-msg b/.githooks/commit-msg new file mode 100755 index 0000000..90978cd --- /dev/null +++ b/.githooks/commit-msg @@ -0,0 +1,15 @@ +#!/bin/sh +set -eu + +subject=$(head -n 1 "$1") +pattern='^de\((python|sql|dsa|pyspark|kafka|databricks|system-design)\): \[(prep|project)\] ([^[:space:]].*[^[:space:]]|[^[:space:]])$' +if ! printf '%s\n' "$subject" | grep -Eq "$pattern"; then + cat >&2 <<'EOF' +Invalid commit subject. Use: + de(): [] +Example: + de(sql): [prep] solve rolling revenue query +See https://github.com/minhazalam/data-engineering-interview-prep/blob/main/docs/commit-message-policy.md for setup and details. +EOF + exit 1 +fi diff --git a/.github/workflows/de-commit-policy.yml b/.github/workflows/de-commit-policy.yml new file mode 100644 index 0000000..bbffa8f --- /dev/null +++ b/.github/workflows/de-commit-policy.yml @@ -0,0 +1,14 @@ +name: Validate DE commit messages + +on: + pull_request: + +permissions: + contents: read + +jobs: + validate: + uses: minhazalam/data-engineering-interview-prep/.github/workflows/validate-de-commit-messages.yml@1fe4838abed2fefeb5e118eb713e1439e9a328e9 + with: + base: ${{ github.event.pull_request.base.sha }} + head: ${{ github.event.pull_request.head.sha }}