Add agentpr issue create/comment/edit
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
ci/woodpecker/pr/pre-commit Pipeline was successful

Filing an issue as unkin-agent means hand-rolling a POST to the issues
API with a manually minted token, the exact credential handling agentpr
exists to encapsulate.

- add `issue create`, `issue comment` and `issue edit`, mirroring the pr
  command group's flags, output and errors
- add CreateIssue/EditIssue to the Gitea client, sharing EditOptions with
  EditPR
- build both comment commands from one constructor so pr and issue
  comments cannot drift off Gitea's shared endpoint
- cover create, edit, a missing repo, an API error and missing flags
This commit is contained in:
2026-09-19 16:11:42 +10:00
parent 72adebbf8b
commit 3de9d35699
6 changed files with 441 additions and 53 deletions
+14 -2
View File
@@ -6,8 +6,8 @@ token from Vault, so automated PRs, comments and pushes are attributed to the
agent — not to whoever happens to run the command. Set `AGENT_LOGIN` to act as a
different agent identity.
- **`agentpr`** — create and edit pull requests, and post PR comments as the
agent user.
- **`agentpr`** — create and edit pull requests and issues, and post comments on
either, as the agent user.
- **`watchpr`** — poll one or more PRs and exit when one changes in a way worth
acting on.
- **`agentws`** — manage per-branch git worktrees for `unkin-agent`, cloning
@@ -56,6 +56,18 @@ agentpr pr edit --repo unkin/argocd-apps --pr 42 --body "Adds the ServiceAccount
agentpr pr edit --repo unkin/argocd-apps --pr 42 --title "Add woodpecker SA"
# prints: #<number> <html_url>
# File an issue (--body optional)
agentpr issue create --repo unkin/argocd-apps \
--title "Woodpecker SA missing" --body "The pipeline fails with ..."
# prints: #<number> <html_url>
# Comment on an issue (the same Gitea endpoint `pr comment` posts to)
agentpr issue comment --repo unkin/argocd-apps --issue 43 --body "Fixed in #44."
# Edit an issue's title and/or body; an omitted flag is left unchanged
agentpr issue edit --repo unkin/argocd-apps --issue 43 --body "The pipeline fails with ..."
# prints: #<number> <html_url>
agentpr --version
agentpr --help
```