Can';找不到从GitHub webhook响应创建SHA256的格式

Can';找不到从GitHub webhook响应创建SHA256的格式,github,sha256,github-webhook,Github,Sha256,Github Webhook,我的GitHub repo中有一个web钩子,每次有推送事件时都会触发它。例如,推送事件JSON如下所示: { “ref”:“refs/heads/developer” “存储库”:{ “id”:123456789, “名称”:“SweetRepo” } } 我向GitHub webhook提供了一个秘密,GitHub在请求头web hook UI中告诉我它创建了abc123456的SHA256(例如) 我正在尝试为webhook创建代理,但我无法自己创建此SHA!我知道我的SHA函数可以工作

我的GitHub repo中有一个web钩子,每次有推送事件时都会触发它。例如,推送事件JSON如下所示:

{
“ref”:“refs/heads/developer”
“存储库”:{
“id”:123456789,
“名称”:“SweetRepo”
}
}
我向GitHub webhook提供了一个秘密,GitHub在请求头web hook UI中告诉我它创建了abc123456的SHA256(例如)

我正在尝试为webhook创建代理,但我无法自己创建此SHA!我知道我的SHA函数可以工作,因为我在“hello world”等示例字符串上测试了它,并与在线转换器进行了比较。但我不明白我应该如何剥离、转义、字符串化或以其他方式格式化GitHub JSON负载,以便它为我提供所需的SHA

更新:

这里有一个完整的例子。我创建了一个新的回购协议。这里有一个指向web钩子的链接,您可以自己查看

以下是GitHub标题:

Request URL: http://example.com:
Request method: POST
Accept: */*
content-type: application/json
User-Agent: GitHub-Hookshot/5465ee1
X-GitHub-Delivery: 4ae55e0e-a9d6-11eb-87d7-8f44c61441ec
X-GitHub-Event: push
X-GitHub-Hook-ID: 294937131
X-GitHub-Hook-Installation-Target-ID: 363207517
X-GitHub-Hook-Installation-Target-Type: repository
X-Hub-Signature: sha1=9c62a9ab96bfe7a0f9b0b511dd9346a8f5ad7e69
X-Hub-Signature-256: sha256=aaaa0a8550aba58490572b65f998950a242ac61e20f2e295f1c839f58e6b3a23
这是有效载荷:

{
“ref”:“refs/heads/main”,
“之前”:“0000000000000000000000000000000000”,
“之后”:“3f07cfffce2cf13559f33f11561dc8ec139a33a9”,
“存储库”:{
“id”:363207517,
“节点id”:“MDEwOlJlcG9zaXRvcnkzNjMyMDc1MTc=”,
“名称”:“webhook测试”,
“全名”:“me/webhook测试”,
“私人”:假,
“所有者”:{
“姓名”:“我”,
“电子邮件”:me@gmail.com",
“登录”:“我”,
“id”:482183,
“节点id”:“MDQ6VXNlcjQ4MjE4Mw=”,
“头像url”:https://avatars.githubusercontent.com/u/482183?v=4",
“gravatar_id”:“,
“url”:”https://api.github.com/users/me",
“html_url”:”https://github.com/me",
“关注者url”:https://api.github.com/users/me/followers",
“以下url:”https://api.github.com/users/me/following{/other_user}“,
“gists_url”:https://api.github.com/users/me/gists{/gist_id}“,
“带星号的url”:https://api.github.com/users/me/starred{/owner}{/repo}“,
“订阅\u url”:https://api.github.com/users/me/subscriptions",
“组织\u url”:https://api.github.com/users/me/orgs",
“repos_url”:https://api.github.com/users/me/repos",
“事件\u url”:https://api.github.com/users/me/events{/隐私}“,
“收到的\u事件\u url”:https://api.github.com/users/me/received_events",
“类型”:“用户”,
“站点管理”:false
},
“html_url”:”https://github.com/me/webhook-test",
“描述”:空,
“叉子”:错,
“url”:”https://github.com/me/webhook-test",
“forks_url”:https://api.github.com/repos/me/webhook-test/forks",
“密钥\u url”:https://api.github.com/repos/me/webhook-test/keys{/key_id}“,
“合作者\u url”:https://api.github.com/repos/me/webhook-test/collaborators{/collaborator}“,
“团队url”:https://api.github.com/repos/me/webhook-test/teams",
“hooks\u url”:https://api.github.com/repos/me/webhook-test/hooks",
“问题\u事件\u url”:https://api.github.com/repos/me/webhook-test/issues/events{/number}“,
“事件\u url”:https://api.github.com/repos/me/webhook-test/events",
“受让人地址”:https://api.github.com/repos/me/webhook-test/assignees{/user}“,
“分支机构url”:https://api.github.com/repos/me/webhook-test/branches{/branch}“,
“标记\u url”:”https://api.github.com/repos/me/webhook-test/tags",
“blobs_url”:https://api.github.com/repos/me/webhook-test/git/blobs{/sha}“,
“git_标记_url”:https://api.github.com/repos/me/webhook-test/git/tags{/sha}“,
“git_refs_url”:https://api.github.com/repos/me/webhook-test/git/refs{/sha}“,
“树的url”:https://api.github.com/repos/me/webhook-test/git/trees{/sha}“,
“状态\u url”:https://api.github.com/repos/me/webhook-test/statuses/{sha}“,
“语言和url”:https://api.github.com/repos/me/webhook-test/languages",
“星探网址”:https://api.github.com/repos/me/webhook-test/stargazers",
“贡献者url”:https://api.github.com/repos/me/webhook-test/contributors",
“订阅服务器\u url”:https://api.github.com/repos/me/webhook-test/subscribers",
“订阅url”:https://api.github.com/repos/me/webhook-test/subscription",
“提交url”:https://api.github.com/repos/me/webhook-test/commits{/sha}“,
“git\u提交\u url”:https://api.github.com/repos/me/webhook-test/git/commits{/sha}“,
“注释\u url”:https://api.github.com/repos/me/webhook-test/comments{/number}“,
“问题注释url”:https://api.github.com/repos/me/webhook-test/issues/comments{/number}“,
“内容\u url”:https://api.github.com/repos/me/webhook-test/contents/{+path}“,
“比较url”:https://api.github.com/repos/me/webhook-test/compare/{base}…{head}”,
“合并url”:https://api.github.com/repos/me/webhook-test/merges",
“存档url”:https://api.github.com/repos/me/webhook-test/{archive_format}{/ref}”,
“下载\u url”:https://api.github.com/repos/me/webhook-test/downloads",
“问题\u url”:https://api.github.com/repos/me/webhook-test/issues{/number}“,
“您的url”:https://api.github.com/repos/me/webhook-test/pulls{/number}“,
“里程碑\u url”:https://api.github.com/repos/me/webhook-test/milestones{/number}“,
“通知\u url”:https://api.github.com/repos/me/webhook-test/notifications{?因为,所有,参与}”,
“标签和url”:https://api.github.com/repos/me/webhook-test/labels{/name}“,
“发布url”:https://api.github.com/repos/me/webhook-test/releases{/id}“,
“部署\u url”:https://api.github.com/repos/me/webhook-test/deployments",
“创建于”:1619802247,
“更新时间”:“2021-04-30T17:04:07Z”,
“推至”:1619802340,
“git_url”:git://github.com/me/webhook-test.git",
“ssh_url”:”git@github.com:me/webhook test.git“,
“克隆url”:https://github.com/me/webhook-test.git",
“svn_url”:https://github.com/me/webhook-test",
“主页”:空,
“大小”:0,
“观星者计数”:0,