review try-out: open a PR with the classifications on the page
The try-out page gets an "open a PR" button. It posts the page's classifications to the new POST /api/review-classifier/open-pr, which merges them by name into the repo's rules file on the default branch and has the review-classifier forge account commit the result on a new branch, review-classifier/<user>-<8 hex>, through the contents API. The commit's author is the forge account named like the session's Remote-User, read with the controller's admin token. The answer links to the forge's compare page, where the user opens the PR as themselves. The push uses the account's existing token from the store (swarm/services/review-classifier/forge/token, scope write:repository), so the account needs write access to the repo; a refused push answers 403 naming that. In a YAML rules file, the entries the merge leaves alone keep their text, as long as the result reads back as the merged list; otherwise the file is written out whole. DefaultBranchFiles now carries each file's blob sha, which the forge needs to replace a file, and the repo's web URL for the link. Fixes #5259 Refs #5096
This commit is contained in:
parent
6ed88ad70a
commit
49b15e7775
10 changed files with 1231 additions and 53 deletions
|
|
@ -112,10 +112,21 @@ and the head commit the run read. A failed run shows its error, for example when
|
|||
has no API key yet.
|
||||
|
||||
What you typed stays after a run, so you can edit the classification and run it
|
||||
again. The page saves no classification and no result, and posts nothing to the
|
||||
forge; like every table in the UI, the result table remembers its column
|
||||
again. The page saves no classification and no result, and a run posts nothing
|
||||
to the forge; like every table in the UI, the result table remembers its column
|
||||
filters in the browser. It shows no token counts, cache counts or cost.
|
||||
|
||||
When a classification answers the way you want, **open a PR** proposes the
|
||||
classifications on the page to the repo. The classifier's forge account pushes
|
||||
a branch that adds them to the repo's rules file, with you as the commit's
|
||||
author, and the page links to the forge's page for opening the PR from that
|
||||
branch, where you log in as usual. A classification named like one the file
|
||||
already holds replaces it, and the file's other rules stay. It needs no PR
|
||||
number. If the forge has no account of yours yet, log in to the forge once
|
||||
first. If the classifier's account may not push to the repo, the page says so:
|
||||
a repo admin adds it as a collaborator with write access
|
||||
([the service account](review-classifier.md#the-service-account)).
|
||||
|
||||
### Classifier settings
|
||||
|
||||
Under the try-out form, **classifier settings** shows the runtime, model and
|
||||
|
|
|
|||
Loading…
Reference in a new issue