-
Notifications
You must be signed in to change notification settings - Fork 1
66 lines (58 loc) · 2.55 KB
/
Copy patharchitecture-gates.yml
File metadata and controls
66 lines (58 loc) · 2.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
name: architecture-gates
on:
pull_request:
push:
branches: [main]
jobs:
mechanical-architecture-gates:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Ensure script is executable
run: chmod +x scripts/review-checklist.sh
- name: Compute PR diff SHAs
id: shas
shell: bash
run: |
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
echo "base_sha=${{ github.event.pull_request.base.sha }}" >> "$GITHUB_OUTPUT"
echo "head_sha=${{ github.event.pull_request.head.sha }}" >> "$GITHUB_OUTPUT"
else
# push event fallback: previous commit -> current SHA
# github.event.before is the all-zero null SHA on first-time branch pushes
before="${{ github.event.before }}"
if [[ "$before" == "0000000000000000000000000000000000000000" ]]; then
# First-time branch push: verify parent exists before using it
if git rev-parse --verify "${{ github.sha }}^" >/dev/null 2>&1; then
before="${{ github.sha }}^"
else
# Initial repo commit: no parent; leave base_sha unset so the
# script falls back to its HEAD~1 HEAD path gracefully
before=""
fi
fi
if [[ -n "$before" ]]; then
echo "base_sha=$before" >> "$GITHUB_OUTPUT"
fi
echo "head_sha=${{ github.sha }}" >> "$GITHUB_OUTPUT"
fi
- name: Run architecture mechanical gates
env:
BASE_REF_SHA: ${{ steps.shas.outputs.base_sha }}
HEAD_REF_SHA: ${{ steps.shas.outputs.head_sha }}
# Customize policy here (regex, colon-separated for multiple rules)
FORBIDDEN_TRACKED_PATHS_REGEX: "^\\.gitmind/materialized/|^\\.gitmind/cache/|^dist/materialized/|^tmp/materialized/"
PUBLISH_ALLOWLIST_REGEX: "^docs/published/"
GENERATED_MARKER_REGEX: "^x-gitmind-generated:|^# Generated by Git Mind|^<!-- Generated by Git Mind -->"
SCHEMA_DIR: "contracts/schemas"
CONTRACT_DIR_REGEX: "^src/(contracts|api)/|^contracts/|^docs/contracts/"
CORE_PATH_REGEX: "^src/(domain|core|engine|materialization)/"
WORKTREE_COUPLING_PATTERN: "process\\.cwd\\(|fs\\.readFileSync\\(|fs\\.readFile\\(|git\\s+rev-parse\\s+--show-toplevel|git\\s+status"
run: |
scripts/review-checklist.sh