feat: delivery id, review events, files and commits of PR #24
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
feature
good first issue
help wanted
invalid
question
wontfix
bug
docs
duplicate
enhancement
help wanted
question
refactor
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
uzinfocom/forgejo!24
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/pr-tracking"
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?
Webhook callback can get
X-Forgejo-DeliverythroughwebhookHandlerWithnow, and review events are parsed as pull request payload. Events which we don't handle answer 200 instead of 400, so Forgejo doesn't show them as failed.Also added
getPullRequestFilesandgetPullRequestCommits(reads all pages, page size is optional) and all pull request hook actions inHookPullRequestAction. Kotiba needs them for PR tracking.Additional: Separating treefmtPackage due to code style in all our repos.
WIP: [FEATURE]: PR tracking-related featuresto feat: delivery id, review events, files and commits of PR@ -109,3 +124,3 @@data HookPullRequestAction= PrOpened| PrClosed| PrClosed -- a merged PR is closed with prMerged = TrueI think it would also be ergonomic to make the
PrMergedaction separate.But PrClosed state is works for both: Not merged and merged PRs. It's better to keep merged as separate field via keeping PrClosed state only, 'cause it matches Forgejo's philosophy in point.
Hmm, but all VCS hosts have actions corresponding to the "PR merged" event.
codeberg.org/forgejo/forgejo@085044a2cc/modules/structs/hook.go (L291-L320)As you can see, here's no PrMerged action because of Forgejo sees pulls and issues same. And developing ergonomics of PrMerged action will create more pain in the neck instead as it doesn't match to Forgejo's source code itself
@ -0,0 +12,4 @@-- A commit as listed by GET /repos/{owner}/{repo}/pulls/{index}/commits.-- Only the fields we use are decoded.data PullRequestCommit = PullRequestCommit{ pcSha :: Textwhich sha ? you mean
sha1orsha256?@ -43,0 +94,4 @@-> Maybe Text-> Value-> m ()webhookHandlerWith cb (Just (Right event)) mEventType mDeliveryId body =use
LambdaCaseHow?
ah, we have destructors :(
@ -43,0 +98,4 @@case parseWebhookPayload event body ofLeft err -> throwError err400{errBody = BSLC.pack err}Right Nothing -> pure ()Right (Just payload) -> cb delivery payloadIs it correct for us to send the parsed payload return as webhook response?
cb is our custom function which is passed as argument into webhookHandlerWith
I think need to wrap newtype for sha references.
And we can use like this.
@ -50,0 +110,4 @@TODO: stop on empty page instead, so that a big size can't skip data. It costs one more request per list.-}fetchAllPages :: (Monad m) => Int -> (Int -> Int -> m [a]) -> m [a]maybe good if apis like this take
Settginsparameter because fetch APIs can have multiple query parameters, such aspage,pageSize,filteretc...Will create issue for enhancing
fetchAllPages@ -34,6 +36,7 @@ data PullRequestRoutes route = PullRequestRoutes'[ WithStatus 201 [PullReviewRequest], WithStatus 422 APIValidationError]-- ^ POST /repos/:owner/:repo/pulls/:index/requested_reviewerswrhite paths like this
/repos/{owner}/{repo}/pulls/{index}/requested_reviewers@lambdajon wrote in #24 (comment):
I think it's better to create separated issue for this task. Because we have countless of sha references in our codebase, so we would avoid increasing offtopic changes in current PR by implementing your idea in separated PR