GitHub App 一键安装:manifest 建 App、安装记录、双 secret 验签、/fix-review 内容去重
This commit is contained in:
1 parent
ecf4b5c715
commit
32059178bd
5 files changed
+1210
-14
No files matched your search
@@ -60,6 +60,20 @@ def verify_github_signature(secret, payload_bytes, signature_header):
|
||||
return hmac.compare_digest(expected, signature_header)
|
||||
|
||||
|
||||
def verify_github_signature_any(secrets, payload_bytes, signature_header):
|
||||
"""多 secret 验签:任一 secret 对上即 True,全不对或无 secret
|
||||
即 False。过渡期手动 webhook(env secret)与 App webhook
|
||||
(库里 secret)共存时用;App 装好、手动 webhook 删掉后,
|
||||
env secret 自然不再被命中,不用改代码。"""
|
||||
if not secrets:
|
||||
return False
|
||||
for secret in secrets:
|
||||
if secret and verify_github_signature(
|
||||
secret, payload_bytes, signature_header):
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def parse_github_pr_comment(payload):
|
||||
"""解析 GitHub issue_comment 事件,返回 fix-review 触发点或 None。
|
||||
|
||||
|
||||
Reference in new issue
Block a user