Skip to content

armgit / AiSOC

Public Imported from GitHub
0

Open-source AI Security Operations Center: alert fusion, LLM-agent triage, MITRE ATT&CK investigation, and a replayable decision ledger for every agent step. Self-hostable, runs with no API keys, MIT licensed. Ships an MCP server for Claude, Cursor and Continue.

fix(ci): adoption snapshot lands on an unprotected data branch, needing no owner credential (#1445) (#1470)

Beenu Aroraa2d53aca076c
diff --git a/.github/workflows/adoption-snapshot.yml b/.github/workflows/adoption-snapshot.yml
index 5777d2307..2b5bdd7fb 100644
--- a/.github/workflows/adoption-snapshot.yml
+++ b/.github/workflows/adoption-snapshot.yml
@@ -9,6 +9,18 @@ name: Adoption snapshot
# and PyPI download counts — and commits a dated row. No collector to run, no
# data asked of users, and a missing source is recorded as "not measured"
# rather than zero.
+#
+# The row lands on the unprotected `adoption-data` branch, not on `main`
+# (#1445). `main` is branch-protected with no bypass actors, so the old
+# direct push failed with GH006 on every scheduled run since protection
+# landed — and the obvious alternative, a PR opened with GITHUB_TOKEN, sits
+# unmergeable forever because events created by that token never trigger the
+# `pull_request` workflows the ~28 required checks come from. Every escape
+# that keeps the data on `main` needs an owner-provisioned credential (PAT,
+# App, or a protection bypass that re-opens the hole protection closed).
+# A data branch needs none of that, and nothing on `main` ever consumed
+# `docs/adoption` programmatically — it is a ledger humans read, and the
+# ledger's own history lives inside snapshot.json either way.
on:
schedule:
@@ -35,6 +47,27 @@ jobs:
with:
python-version: '3.11'
+ # The ledger lives on `adoption-data`; the collector appends to whatever
+ # history it finds in the working tree, so the branch's state is
+ # overlaid first. A missing branch is the fresh-ledger state, not an
+ # error — the json carries its own history, so nothing is lost either
+ # way.
+ - name: Overlay the ledger from the data branch
+ run: |
+ set -euo pipefail
+ # The branch tip is carried in GITHUB_ENV, never read back from
+ # FETCH_HEAD in a later step: actions/checkout runs its own fetch,
+ # so FETCH_HEAD exists even when this branch does not, and a data
+ # commit parented on main's tip would render as a mass deletion.
+ if git fetch --depth 1 origin adoption-data; then
+ tip=$(git rev-parse FETCH_HEAD)
+ git checkout "$tip" -- docs/adoption
+ echo "ADOPTION_PARENT=$tip" >> "$GITHUB_ENV"
+ echo "overlaid docs/adoption from adoption-data (${tip})"
+ else
+ echo "::notice title=adoption::no adoption-data branch yet; starting a fresh ledger"
+ fi
+
# GITHUB_TOKEN carries push access for this repo, which the traffic API
# requires. Without it views/clones come back 403 and land as
# "not measured".
@@ -43,7 +76,11 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: python3 scripts/adoption_snapshot.py --write
- - name: Commit if anything moved
+ # Commit to `adoption-data` without touching this checkout's branch:
+ # build a root tree holding ONLY docs/adoption (so the data branch can
+ # never be mistaken for a code branch), parent it on the branch tip, and
+ # fast-forward push. No force — month over month this is an append.
+ - name: Commit the row to the data branch
run: |
set -euo pipefail
if git diff --quiet -- docs/adoption; then
@@ -53,5 +90,14 @@ jobs:
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add docs/adoption
- git commit -m "chore(adoption): monthly snapshot"
- git push
+ full_tree=$(git write-tree)
+ adoption_tree=$(git rev-parse "${full_tree}:docs/adoption")
+ docs_tree=$(printf '040000 tree %s\tadoption\n' "$adoption_tree" | git mktree)
+ root_tree=$(printf '040000 tree %s\tdocs\n' "$docs_tree" | git mktree)
+ if [ -n "${ADOPTION_PARENT:-}" ]; then
+ commit=$(git commit-tree "$root_tree" -p "$ADOPTION_PARENT" -m "chore(adoption): monthly snapshot")
+ else
+ commit=$(git commit-tree "$root_tree" -m "chore(adoption): monthly snapshot")
+ fi
+ git push origin "${commit}:refs/heads/adoption-data"
+ echo "::notice title=adoption::Snapshot committed to adoption-data (${commit})."
diff --git a/docs/adoption/README.md b/docs/adoption/README.md
index defcb5724..81e88bc12 100644
--- a/docs/adoption/README.md
+++ b/docs/adoption/README.md
@@ -1,47 +1,23 @@
-# Adoption snapshot
+# Adoption snapshot — the ledger lives on the `adoption-data` branch
-Collected by `scripts/adoption_snapshot.py`, refreshed monthly by
-`.github/workflows/adoption-snapshot.yml`. Everything here comes from
-public GitHub and registry APIs — the project ships no usage telemetry
-that phones home.
-
-A value of **not measured** means the source could not be read on that
-run. It does not mean zero. The two get conflated constantly and the
-difference matters: one is a fact about users, the other is a fact
-about our tooling.
-
-## Latest — 2026-09-21
-
-### Reach
-
-- Stars: 2,361
-- Forks: 259
-- Unique visitors (14d): 1,541
-- Unique cloners (14d): 377
+The monthly adoption ledger is committed to the unprotected
+[`adoption-data`](https://github.com/beenuar/AiSOC/tree/adoption-data/docs/adoption)
+branch, not to `main`:
-### Conversion
+- [`docs/adoption/README.md` (rendered latest row)](https://github.com/beenuar/AiSOC/blob/adoption-data/docs/adoption/README.md)
+- [`docs/adoption/snapshot.json` (full history)](https://github.com/beenuar/AiSOC/blob/adoption-data/docs/adoption/snapshot.json)
-- Contributors: 13
-- Release asset downloads (all time): 52
-
-### Package downloads (last month)
-
-- npm `aisoc`: not measured
-- npm `@aisoc/mcp`: not measured
-- npm `@aisoc/sdk`: not measured
-- PyPI `aisoc-sandbox`: not measured
-- PyPI `aisoc-cli`: not measured
-- PyPI `aisoc-sdk`: not measured
-- PyPI `aisoc-plugin-sdk`: not measured
-- PyPI `aisoc-detections`: not measured
-
-### Why some values are missing
-
-- npm aisoc: not published yet
-- npm @aisoc/mcp: not published yet
-- npm @aisoc/sdk: not published yet
-- pypi aisoc-sandbox: registry did not answer (HTTP 429)
-- pypi aisoc-cli: registry did not answer (HTTP 429)
-- pypi aisoc-sdk: registry did not answer (HTTP 429)
-- pypi aisoc-plugin-sdk: not published yet
-- pypi aisoc-detections: not published yet
+Collected by `scripts/adoption_snapshot.py`, refreshed monthly by
+`.github/workflows/adoption-snapshot.yml`. Everything in it comes from public
+GitHub and registry APIs — the project ships no usage telemetry that phones
+home. A value of **not measured** means the source could not be read on that
+run; it does not mean zero.
+
+Why a branch: `main` is branch-protected with no bypass actors, so the
+workflow's direct push fails (GH006), and a PR opened with `GITHUB_TOKEN`
+can never merge because events created by that token do not trigger the
+`pull_request` workflows the required checks come from. Every path that keeps
+the data on `main` needs an owner-provisioned credential; the data branch
+needs none, and nothing on `main` reads these files programmatically. The
+history is carried inside `snapshot.json` itself, so the ledger is complete
+wherever it lives.
diff --git a/docs/adoption/snapshot.json b/docs/adoption/snapshot.json
deleted file mode 100644
index 0dddae157..000000000
--- a/docs/adoption/snapshot.json
+++ /dev/null
@@ -1,43 +0,0 @@
-{
- "history": [
- {
- "date": "2026-09-21",
- "repo": "beenuar/AiSOC",
- "github": {
- "stars": 2361,
- "forks": 259,
- "watchers": 37,
- "open_issues": 12,
- "views_14d": 4333,
- "unique_views_14d": 1541,
- "clones_14d": 1236,
- "unique_clones_14d": 377,
- "contributors": 13,
- "releases": 9,
- "release_asset_downloads": 52
- },
- "npm": {
- "aisoc": null,
- "@aisoc/mcp": null,
- "@aisoc/sdk": null
- },
- "pypi": {
- "aisoc-sandbox": null,
- "aisoc-cli": null,
- "aisoc-sdk": null,
- "aisoc-plugin-sdk": null,
- "aisoc-detections": null
- },
- "notes": [
- "npm aisoc: not published yet",
- "npm @aisoc/mcp: not published yet",
- "npm @aisoc/sdk: not published yet",
- "pypi aisoc-sandbox: registry did not answer (HTTP 429)",
- "pypi aisoc-cli: registry did not answer (HTTP 429)",
- "pypi aisoc-sdk: registry did not answer (HTTP 429)",
- "pypi aisoc-plugin-sdk: not published yet",
- "pypi aisoc-detections: not published yet"
- ]
- }
- ]
-}
diff --git a/scripts/adoption_snapshot.py b/scripts/adoption_snapshot.py
index 429a000c5..f2db7eec3 100644
--- a/scripts/adoption_snapshot.py
+++ b/scripts/adoption_snapshot.py
@@ -21,8 +21,13 @@ saying why. It is never recorded as zero, because "nobody downloaded it" and
starts lying.
Usage:
- python3 scripts/adoption_snapshot.py --write # update the committed snapshot
+ python3 scripts/adoption_snapshot.py --write # update docs/adoption in the working tree
python3 scripts/adoption_snapshot.py # print JSON, change nothing
+
+The committed ledger lives on the unprotected `adoption-data` branch (#1445);
+the workflow overlays that branch's docs/adoption into the working tree before
+calling --write, so the history this script appends to is the branch's, and
+the result is committed back there — never to protected `main`.
"""
from __future__ import annotations