fix(ci): make /pi invocable on org-owned repos via API permission check #14
No reviewers
Labels
No labels
dependencies
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
alex/.profile!14
Loading…
Reference in a new issue
No description provided.
Delete branch "pi/issue13-1786732047274"
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?
Fixes #13
Problem
The job-level guard in
pi.yml:compares the commenting user against
forgejo.repository_owner. On org-owned repos (org/repo) the repository owner is the organization, sosender.login == repository_ownercan never be true — the job is always skipped and/pinever runs.Fix
Authorization is now enforced per-event by an Authorize invoker step that queries the Forgejo API for the sender's effective permission on the repository (
GET /repos/{owner}/{repo}/collaborators/{user}/permission, authenticated assecrets.PI_TOKEN):owneroradminpermission → the agent runswrite/read/none) → the job fails with a clear::error::messageThis covers both
user/repoandorg/repolayouts uniformly, since org owners/admins getowner/adminon their org's repos.The job-level
if:now only gates on the/picommand prefix (issue comment, review comment or review body), which also restores triggering from PR review bodies (review.content) that was dropped in6fb8f3b.Notes
forge.l3x.in: repo owner →owner(allowed), non-collaborator →none(denied). The permission query requires thepiuser behindPI_TOKENto be site admin or repo/org admin (it is a site admin here).PI_TOKENand thePROVIDER/MODEL/THINKING_LEVEL/MY_FORGEJO_PUBLIC_URLvars must exist at org level — documented indocs/setup-pi-bot.md.