feat(api): add GET /:id/ci/status
This commit is contained in:
@@ -50,6 +50,7 @@ const {
|
||||
} = require("../lib/lane-runtime");
|
||||
const { reapOrphanMcp, capOversizedLogs } = require("../lib/lane-gc");
|
||||
const { detectNode, scaffoldProfile } = require("../lib/lane-detect");
|
||||
const { ciStatus } = require("../lib/ci-status");
|
||||
|
||||
const router = Router();
|
||||
const MAX_WORKTREE_DIRECTORY_ATTEMPTS = 50;
|
||||
@@ -520,6 +521,27 @@ router.get("/:id/git", async (req, res) => {
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* A single GitHub Actions status snapshot for one ref (branch or commit sha)
|
||||
* in the lane's repo — NOT a poll loop. ship-feature-lane's Stage 13 owns
|
||||
* the wait/retry decision (docs/LANES.md "Orchestration: what CCAM does NOT
|
||||
* do"); this route only reports what `gh` currently knows. Read-only, no
|
||||
* same-origin guard, same reasoning as GET /:id/git.
|
||||
*/
|
||||
router.get("/:id/ci/status", async (req, res) => {
|
||||
const lane = laneOr404(req, res);
|
||||
if (!lane) return;
|
||||
const ref = typeof req.query.ref === "string" ? req.query.ref.trim() : "";
|
||||
if (!ref) {
|
||||
return res.status(400).json({ error: { code: "EBADREF", message: "ref is required" } });
|
||||
}
|
||||
try {
|
||||
res.json(await ciStatus(lane.cwd, ref));
|
||||
} catch (err) {
|
||||
sendRuntimeError(res, err);
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Create a dashboard-managed worktree lane. Git work happens after the 202
|
||||
* response because provisioning a large repository can take seconds.
|
||||
|
||||
Reference in New Issue
Block a user