Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F85711160
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/lilybuild/lilybuild/forgejo.py b/lilybuild/lilybuild/forgejo.py
new file mode 100644
index 0000000..101991d
--- /dev/null
+++ b/lilybuild/lilybuild/forgejo.py
@@ -0,0 +1,22 @@
+
+from twisted.internet import defer
+from buildbot.www.hooks.github import GitHubEventHandler
+
+PARENT_FIRST = 'PARENT_FIRST'
+CHILD_FIRST = 'CHILD_FIRST'
+
+# Forgejo webhooks return the commits in child-first order
+# https://codeberg.org/forgejo/forgejo/issues/7737
+# This helper class intercepts the payload and reverse the
+# order of the commits.
+class ForgejoEventHandler(GitHubEventHandler):
+ def __init__(self, secret, strict, commits_order=CHILD_FIRST, **kwargs):
+ self.commits_order = commits_order
+ super().__init__(secret, strict, **kwargs)
+
+ @defer.inlineCallbacks
+ def _get_payload(self, request):
+ payload = yield super()._get_payload(request)
+ if 'commits' in payload and self.commits_order == CHILD_FIRST:
+ payload['commits'].reverse()
+ return payload
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Sat, Sep 19, 4:14 AM (1 d, 2 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1768837
Default Alt Text
(1 KB)
Attached To
Mode
rB lilybuild
Attached
Detach File
Event Timeline
Log In to Comment