Skip to content

Commit b34263a

Browse files
Merge pull request 'fix(governance): add Eos submodule freshness workflow and path-compatible checks (#57)' (#60) from fix/57-governance-freshness-wiring into main
Reviewed-on: https://gitea.cybermonkey.sh/cybermonkey/eos/pulls/60
2 parents 0c50e74 + d1686b0 commit b34263a

4 files changed

Lines changed: 123 additions & 1 deletion

File tree

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Submodule Freshness Check
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
auto_update:
7+
description: "Automatically bump stale prompts submodule in workflow workspace"
8+
required: false
9+
default: "false"
10+
schedule:
11+
- cron: "17 */6 * * *"
12+
pull_request:
13+
branches:
14+
- main
15+
16+
jobs:
17+
submodule-freshness:
18+
runs-on: [self-hosted, general]
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
22+
with:
23+
submodules: recursive
24+
25+
- name: Verify prompts freshness
26+
env:
27+
AUTO_UPDATE: ${{ inputs.auto_update || 'false' }}
28+
run: |
29+
set -euo pipefail
30+
chmod +x scripts/prompts-submodule-freshness.sh
31+
./scripts/prompts-submodule-freshness.sh

Makefile

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
# Last Updated: 2025-10-23
33

44
.PHONY: all build test lint lint-fix clean install help \
5-
ci-preflight ci-lint ci-unit ci-integration ci-e2e-smoke ci-fuzz ci-coverage-delta
5+
ci-preflight ci-lint ci-unit ci-integration ci-e2e-smoke ci-fuzz ci-coverage-delta \
6+
governance-check submodule-freshness
67

78
# Build configuration
89
BINARY_NAME := eos
@@ -224,6 +225,14 @@ ci-coverage-delta: ## Run CI coverage delta check (PR context)
224225
@echo "[INFO] Running CI coverage delta..."
225226
@scripts/ci/coverage-delta.sh coverage.out
226227

228+
governance-check: ## Run governance wiring checks from prompts submodule
229+
@echo "[INFO] Running governance checks..."
230+
@scripts/check-governance.sh
231+
232+
submodule-freshness: ## Verify prompts submodule is current with upstream main
233+
@echo "[INFO] Checking prompts submodule freshness..."
234+
@scripts/prompts-submodule-freshness.sh
235+
227236
##@ Deployment
228237

229238
DEPLOY_SERVERS ?= vhost2

scripts/check-governance.sh

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
# Run prompts governance checks regardless of submodule path convention.
5+
repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
6+
7+
if [[ -x "${repo_root}/third_party/prompts/scripts/check-governance.sh" ]]; then
8+
CONSUMING_REPO_ROOT="${repo_root}" "${repo_root}/third_party/prompts/scripts/check-governance.sh"
9+
exit $?
10+
fi
11+
12+
if [[ ! -x "${repo_root}/prompts/scripts/check-governance.sh" ]]; then
13+
echo "ERROR: prompts governance checker not found in third_party/prompts/ or prompts/"
14+
exit 2
15+
fi
16+
17+
mkdir -p "${repo_root}/third_party"
18+
created_link=false
19+
if [[ ! -e "${repo_root}/third_party/prompts" ]]; then
20+
ln -s ../prompts "${repo_root}/third_party/prompts"
21+
created_link=true
22+
fi
23+
24+
cleanup() {
25+
if [[ "${created_link}" == "true" ]]; then
26+
rm -f "${repo_root}/third_party/prompts"
27+
fi
28+
}
29+
trap cleanup EXIT
30+
31+
CONSUMING_REPO_ROOT="${repo_root}" "${repo_root}/prompts/scripts/check-governance.sh"
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
5+
auto_update="${AUTO_UPDATE:-false}"
6+
7+
prompts_path=""
8+
if [[ -d "${repo_root}/prompts/.git" || -f "${repo_root}/prompts/.git" ]]; then
9+
prompts_path="prompts"
10+
elif [[ -d "${repo_root}/third_party/prompts/.git" || -f "${repo_root}/third_party/prompts/.git" ]]; then
11+
prompts_path="third_party/prompts"
12+
fi
13+
14+
if [[ -z "${prompts_path}" ]]; then
15+
echo "FAIL: prompts submodule not found at prompts/ or third_party/prompts/"
16+
exit 1
17+
fi
18+
19+
local_sha="$(git -C "${repo_root}/${prompts_path}" rev-parse HEAD)"
20+
if ! git -C "${repo_root}/${prompts_path}" fetch origin main --quiet; then
21+
echo "FAIL: unable to fetch ${prompts_path} origin/main"
22+
exit 1
23+
fi
24+
remote_sha="$(git -C "${repo_root}/${prompts_path}" rev-parse origin/main)"
25+
26+
echo "prompts_path=${prompts_path}"
27+
echo "local_sha=${local_sha}"
28+
echo "remote_sha=${remote_sha}"
29+
30+
if [[ "${local_sha}" == "${remote_sha}" ]]; then
31+
echo "PASS: prompts submodule is up to date"
32+
exit 0
33+
fi
34+
35+
echo "WARN: prompts submodule is stale"
36+
if [[ "${auto_update}" == "true" ]]; then
37+
if git -C "${repo_root}" submodule status -- "${prompts_path}" >/dev/null 2>&1; then
38+
git -C "${repo_root}" submodule update --remote -- "${prompts_path}"
39+
updated_sha="$(git -C "${repo_root}/${prompts_path}" rev-parse HEAD)"
40+
echo "UPDATED_SUBMODULE: ${local_sha:0:7} -> ${updated_sha:0:7}"
41+
exit 0
42+
fi
43+
44+
git -C "${repo_root}/${prompts_path}" checkout --detach "${remote_sha}" >/dev/null 2>&1
45+
updated_sha="$(git -C "${repo_root}/${prompts_path}" rev-parse HEAD)"
46+
echo "UPDATED_WORKTREE_ONLY: ${local_sha:0:7} -> ${updated_sha:0:7}"
47+
exit 0
48+
fi
49+
50+
echo "Run: git submodule update --remote -- ${prompts_path}"
51+
exit 1

0 commit comments

Comments
 (0)