Forgejo: CI watchdog for branches without a PR #163
No reviewers
Labels
No labels
Agent
Ignore
Agent
In Progress
Agent
Planned
Agent
Planning
Agent
Ready
Agent
Triage
Compat
Breaking
Kind
Bug
Kind
Documentation
Kind
Enhancement
Kind
Feature
Kind
Security
Kind
Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
lucas/omp-deck!163
Loading…
Reference in a new issue
No description provided.
Delete branch "agent/issue-146-branch-ci-watchdog"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes: #146
What
ci_watchdog.branchesin.omp/forgejo.yaml: a list ofBun.Globpatterns (*stays within one segment,**crosses/). Absent or empty disables it.handleCommitStatus: once all checks on a commit have finished and one failed, and the commit is not the head of any open PR and has no waiting post-merge record, the commit is matched against current branch heads through the newDispatchApi.listBranches. Only the first match in config order queues abranch_ci_failedrow (number: 0), and its payload lists every matching branch. If all checks pass at the head of a branch that has an open watch record, abranch_ci_greenrow is queued.forgejo_branch_watch(migration 020) and moduledb/forgejo-branch-watch.ts, one record per branch.forgejo_ci_watchdog:decidelimitsforgejo_create_issue/forgejo_create_issue_commentto one reported issue.branch(branch-<watchId>), restored on resume.in-process.tsrecords the first issue the session creates or comments on as its report. It also maps that issue inforgejo_sessions, unless another session already owns it.resolveBranchWatchSession: continues the record's session, or resolves the record and creates a new session. A green row only continues an existing one.buildBranchCiFailureSeed/buildBranchCiGreenSeed.number: 0skip thread notices and failure comments and go straight to the fallback.Verification
bun run typecheckpasses for all packages.apps/server:bun testpasses (1095 tests). New tests cover:branchesbehaves as before.mapWatchdogIssuelogic was checked with a throwaway script (first issue recorded and mapped; an issue already mapped to another session keeps its mapping).Notes
listBranchesreads the head SHA fromcommit.id, which is Forgejo'sPayloadCommitfield for branch commits. I didn't call it against the live instance..omp/forgejo.yamlis unchanged. Enablingbrancheshere is up to you.Provide an example of the new config
Example
.omp/forgejo.yaml:Bun.Globglobs:*matches within one path segment and**matches across/.branchesis absent or[], the feature is off."`ci_watchdog.branches` must be a list of non-empty strings".