-
Notifications
You must be signed in to change notification settings - Fork 0
112 lines (88 loc) · 3.77 KB
/
ci.yml
File metadata and controls
112 lines (88 loc) · 3.77 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
name: Carmel Judgment Protocol 😼🧪
on:
pull_request:
branches: ["main"]
push:
branches: ["main"]
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
judgment:
name: Carmel Reviews Your Work
runs-on: ubuntu-latest
steps:
- name: 😼 Checkout for Inspection
uses: actions/checkout@v4
with:
submodules: recursive
- name: 👁️ Carmel Submodule Inspection (Canon Check)
run: |
set -euo pipefail
if [ ! -f .gitmodules ]; then
echo "::error::Carmel Judgment: .gitmodules is missing. Submodule not configured."
exit 1
fi
if [ ! -d content ]; then
echo "::error::Carmel Judgment: content/ is missing. Submodule not checked out."
echo "Fix: git submodule update --init --recursive"
exit 1
fi
if [ -z "$(ls -A content 2>/dev/null)" ]; then
echo "::error::Carmel Judgment: content/ exists but is empty. Submodule likely not initialized."
echo "Fix: git submodule update --init --recursive"
exit 1
fi
# A leading "-" means not initialized.
if git submodule status --recursive 2>/dev/null | grep -qE '^\-'; then
echo "::error::Carmel Judgment: submodule(s) not initialized."
echo "Fix: git submodule update --init --recursive"
echo ""
echo "Current status:"
git submodule status --recursive || true
exit 1
fi
echo "😼✨ Canon present. Proceeding."
- name: 😼 Carmel Promotion Gate (explicit acceptance required)
run: |
set -euo pipefail
EVENT_NAME="${{ github.event_name }}"
if [ "$EVENT_NAME" = "pull_request" ]; then
BASE_SHA="${{ github.event.pull_request.base.sha }}"
HEAD_SHA="${{ github.event.pull_request.head.sha }}"
else
BASE_SHA="${{ github.event.before }}"
HEAD_SHA="${{ github.sha }}"
fi
echo "🔎 Comparing: $BASE_SHA..$HEAD_SHA"
# Ensure we have the base commit locally (checkout depth can be shallow)
git fetch --no-tags --prune --depth=200 origin "$BASE_SHA" || true
git fetch --no-tags --prune --depth=200 origin "$HEAD_SHA" || true
# Detect whether the submodule pointer changed in this range
if git diff --name-only "$BASE_SHA" "$HEAD_SHA" | grep -Eq '^content/?$'; then
echo "😼 content submodule pointer changed. Carmel demands explicit promotion language."
MESSAGES="$(git log --format=%B "$BASE_SHA..$HEAD_SHA" || true)"
if ! echo "$MESSAGES" | grep -Eqi 'promote(.*)canon|promote content commit to canon|promotion.*canon'; then
echo "::error::Carmel Judgment: You changed the content submodule pointer without an explicit promotion commit message."
echo "::error::Required: include 'promote ... canon' (e.g., 'DATA [CJO] promote content commit to canon 😼🧪') in at least one commit."
exit 1
fi
echo "✅ Promotion language detected. Carmel permits canon advancement."
else
echo "✅ No canon pointer change detected. Carmel remains calmly judgmental."
fi
- name: 🧶 Set Up Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: "npm"
- name: 🐾 Install Dependencies
run: npm ci
- name: 🔍 Run Test Suite
run: npm test
- name: 🟢 Carmel Verdict
if: success()
run: echo "😼✨ Acceptable. You may proceed."
- name: 🔴 Carmel Displeased
if: failure()
run: echo "😾❌ Unacceptable. Fix it."