Something went wrong. Try again.
Personal fork of prime agent. Mirror of: https://mnemosyne.sigilzero.dev/sigilzero/prime-agent
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586name: Commit Check
on: pull_request: types: - opened - synchronize - reopened
permissions: contents: read
jobs: conventional-commits: name: Conventional Commits runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v6 with: fetch-depth: 0
- name: Fetch PR refs env: BASE_REF: ${{ github.event.pull_request.base.ref }} PR_NUMBER: ${{ github.event.pull_request.number }} run: | set -euo pipefail git fetch --no-tags --prune origin \ "+refs/heads/${BASE_REF}:refs/remotes/origin/${BASE_REF}" \ "+refs/pull/${PR_NUMBER}/head:refs/remotes/pull/${PR_NUMBER}/head"
- name: Install cargo-binstall uses: cargo-bins/cargo-binstall@main
- name: Install cocogitto run: cargo binstall --no-confirm cocogitto@6.5.0
- name: Check PR commit messages env: BASE_SHA: ${{ github.event.pull_request.base.sha }} HEAD_SHA: ${{ github.event.pull_request.head.sha }} NO_COLOR: "1" run: | set -euo pipefail
RANGE="${BASE_SHA}..${HEAD_SHA}" SCOPES=$(awk -F' = ' '$1 == "scopes" { print $2; exit }' cog.toml)
echo "Checking conventional commits in ${RANGE}" git log --oneline --no-decorate "${RANGE}"
set +e output=$(cog check "${RANGE}" 2>&1) status=$? set -e
printf '%s\n' "$output"
if [ "$status" -eq 0 ]; then exit 0 fi
{ echo "## Conventional commit check failed" echo "" echo "\`cog check ${RANGE}\` rejected one or more PR commits." echo "" echo "Configured scopes from \`cog.toml\`: \`${SCOPES}\`." echo "Use an unscoped commit for root crate changes." echo "" echo "Example valid headers:" echo "" echo "- \`fix: correct sequence rendering\`" echo "- \`fix(wasm): correct package export\`" echo "" echo "Cocogitto output:" echo "" echo '```text' printf '%s\n' "$output" echo '```' } >> "$GITHUB_STEP_SUMMARY"
echo "::error title=Invalid conventional commit::Run cog check ${RANGE} locally. Configured scopes: ${SCOPES}. Use an unscoped commit for root crate changes." exit "$status"