Bot handoff: the daily check pulls Ken's bot repo; route model updates go to the bot by pull request
CI / test (pull_request) Successful in 39s
CI / test (pull_request) Successful in 39s
- update-sources: download DragonKind/DragonKind (read with ATLAS_BOT_TOKEN, or DRAGONKIND_TOKEN if set) and import it as the bot source. Needs DK_ACCOUNT_SALT (the same salt as earlier imports, so accounts keep their keys); without it the bot source is skipped as before. - The bot load keeps one file, data/bot/trajectories-bot.jsonl: the bot's repo holds every account's full history, so each import is merged by attempt id (attempts already published stay; older per-import files are folded in). One copy of each attempt also keeps build-graph.js from counting an attempt twice. - New workflow push-policy: when policy.json, solver.js or graph.js change on main, open (or update) a pull request on DragonKind/DragonKind that replaces vendor/threshing-atlas/ with them. Ken merges it. - forge open-pr: --repo/--base for another repository, and reuse the open pull request for the same branch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UCzTd31GphpMXDhQqWrCMQ
This commit is contained in:
+16
-5
@@ -1,6 +1,6 @@
|
||||
"""The repository host (forge.yaml): links, and the few API calls the pipeline makes, for Gitea and GitHub.
|
||||
|
||||
python -m collection forge open-pr --head BRANCH --title T --body-file F [--automerge]
|
||||
python -m collection forge open-pr --head BRANCH --title T --body-file F [--automerge] [--repo OWNER/NAME --base B]
|
||||
python -m collection forge open-issue --title T --body-file F (skipped if an open issue has that title)
|
||||
python -m collection forge ensure-label --name N --color HEX
|
||||
|
||||
@@ -96,10 +96,19 @@ def list_issues(label, env=None, f=None):
|
||||
return sorted(out, key=lambda i: i["number"])
|
||||
|
||||
|
||||
def open_pr(head, title, body, automerge=False, env=None, f=None):
|
||||
f = f or config()
|
||||
def open_pr(head, title, body, automerge=False, env=None, f=None, repo=None, base=None):
|
||||
"""Open a pull request (on this repository, or `repo` on the same host). If one is open for the branch already,
|
||||
it is reused: pushing to its branch has updated it."""
|
||||
f = dict(f or config())
|
||||
if repo:
|
||||
f["repo"] = repo
|
||||
base = base or f["branch"]
|
||||
tok = token(env)
|
||||
pr = _call("POST", f"{api_base(f)}/pulls", {"head": head, "base": f["branch"], "title": title, "body": body}, tok, f)
|
||||
open_prs = _call("GET", f"{api_base(f)}/pulls?state=open&limit=50&per_page=100", tok=tok, f=f) or []
|
||||
same = [p for p in open_prs if (p.get("head") or {}).get("ref") == head]
|
||||
if same:
|
||||
return same[0]["number"]
|
||||
pr = _call("POST", f"{api_base(f)}/pulls", {"head": head, "base": base, "title": title, "body": body}, tok, f)
|
||||
n = pr["number"]
|
||||
if automerge:
|
||||
if f["kind"] == "github":
|
||||
@@ -141,6 +150,8 @@ def main(argv):
|
||||
p.add_argument("--title", required=True)
|
||||
p.add_argument("--body-file", required=True)
|
||||
p.add_argument("--automerge", action="store_true")
|
||||
p.add_argument("--repo", help="another repository on the same host (OWNER/NAME)")
|
||||
p.add_argument("--base", help="the branch to merge into (default: forge.yaml branch)")
|
||||
i = sub.add_parser("open-issue")
|
||||
i.add_argument("--title", required=True)
|
||||
i.add_argument("--body-file", required=True)
|
||||
@@ -150,7 +161,7 @@ def main(argv):
|
||||
a = ap.parse_args(argv)
|
||||
if a.cmd == "open-pr":
|
||||
body = open(a.body_file, encoding="utf-8").read()
|
||||
print(f"pull request #{open_pr(a.head, a.title, body, a.automerge)}")
|
||||
print(f"pull request #{open_pr(a.head, a.title, body, a.automerge, repo=a.repo, base=a.base)}")
|
||||
elif a.cmd == "open-issue":
|
||||
n = open_issue(a.title, open(a.body_file, encoding="utf-8").read())
|
||||
print(f"issue #{n}" if n else "an open issue with that title exists already")
|
||||
|
||||
Reference in New Issue
Block a user