带有github webhook的read-the-docs结果为400:“有效负载无效,签名无效或丢失”

时间:2019-04-02 12:52:01

标签: github github-api read-the-docs github-webhook

我已经按照https://docs.readthedocs.io/en/stable/webhooks.html上的说明进行操作,并在github上添加了一个Webhook来触发我的readthedocs构建,但是readthedocs拒绝了有效载荷:

Response

Status:
    400
Content-Type:
    text/html; charset=utf-8
Allow:
    POST, OPTIONS

详细信息:

{
  "detail": "Payload not valid, invalid or missing signature"
}

这是请求的标头:

Host:
    ...
Connection:
    close
Accept:
    */*
Max-Forwards:
    10
User-Agent:
    GitHub-Hookshot/903858c
X-Github-Event:
    push
X-Github-Delivery:
    2be06d44-552f-11e9-91f6-d1c2bea59bd2
X-Original-Host:
    readthedocs.org
X-Original-Url:
    /api/v2/webhook/.../.../
X-Arr-Ssl:
    2048|256|C=GB, S=Greater Manchester, L=Salford, O=COMODO CA Limited, CN=COMODO RSA Domain Validation Secure Server CA|OU=Domain Control Validated, OU=EssentialSSL Wildcard, CN=*.readthedocs.org
X-Arr-Log-Id:
    fef5ee2e-6edd-4386-ad1f-79400cee2d46
Content-Type:
    application/json 

具有有效载荷:

{
  "after": "..."
  "base_ref": null,
  "before": "..."
  "commits": [
    {
      "added": [],
      "author": {
        "email": "..."
        "name": "..."
        "username": "..."
      },
      "committer": {
        "email": "..."
        "name": "..."
        "username": "..."
      },
      "distinct": true,
      "id": "..."
      "message": "..."
      "modified": [
        ...
      ],
      "removed": [],
      "timestamp": "..."
      "tree_id": "..."
      "url": "..."
    }
  ],
  "compare": "..."
  "created": false,
  "deleted": false,
  "forced": false,
  "head_commit": {
    "added": [],
    "author": {
      "email": "..."
      "name": "..."
      "username": "..."
    },
    "committer": {
      "email": "..."
      "name": "..."
      "username": "..."
    },
    "distinct": true,
    "id": "..."
    "message": "..."
    "modified": [
      ...
    ],
    "removed": [],
    "timestamp": "..."
    "tree_id": "..."
    "url": "..."
  },
  "organization": {
    "avatar_url": "..."
    "description": null,
    "events_url": "..."
    "hooks_url": "..."
    "id": ...,
    "issues_url": "..."
    "login": "..."
    "members_url": "..."
    "node_id": "..."
    "public_members_url": "..."
    "repos_url": "..."
    "url": "..."
  },
  "pusher": {
    "email": "..."
    "name": "..."
  },
  "ref": "..."
  "repository": {
    "archive_url": "..."
    "archived": false,
    "assignees_url": "..."
    "blobs_url": "..."
    "branches_url": "..."
    "clone_url": "..."
    "collaborators_url": "..."
    "comments_url": "..."
    "commits_url": "..."
    "compare_url": "..."
    "contents_url": "..."
    "contributors_url": "..."
    "created_at": ...,
    "default_branch": "..."
    "deployments_url": "..."
    "description": "..."
    "downloads_url": "..."
    "events_url": "..."
    "fork": false,
    "forks": 0,
    "forks_count": 0,
    "forks_url": "..."
    "full_name": "..."
    "git_commits_url": "..."
    "git_refs_url": "..."
    "git_tags_url": "..."
    "git_url": "..."
    "has_downloads": true,
    "has_issues": true,
    "has_pages": false,
    "has_projects": true,
    "has_wiki": true,
    "homepage": "..."
    "hooks_url": "..."
    "html_url": "..."
    "id": ...,
    "issue_comment_url": "..."
    "issue_events_url": "..."
    "issues_url": "..."
    "keys_url": "..."
    "labels_url": "..."
    "language": "..."
    "languages_url": "..."
    "license": {
      "key": "..."
      "name": "..."
      "node_id": "..."
      "spdx_id": "..."
      "url": "..."
    },
    "master_branch": "..."
    "merges_url": "..."
    "milestones_url": "..."
    "mirror_url": null,
    "name": "..."
    "node_id": "..."
    "notifications_url": "..."
    "open_issues": 8,
    "open_issues_count": 8,
    "organization": "..."
    "owner": {
      "avatar_url": "..."
      "email": null,
      "events_url": "..."
      "followers_url": "..."
      "following_url": "..."
      "gists_url": "..."
      "gravatar_id": "..."
      "html_url": "..."
      "id": ...,
      "login": "..."
      "name": "..."
      "node_id": "..."
      "organizations_url": "..."
      "received_events_url": "..."
      "repos_url": "..."
      "site_admin": false,
      "starred_url": "..."
      "subscriptions_url": "..."
      "type": "..."
      "url": "..."
    },
    "private": false,
    "pulls_url": "..."
    "pushed_at": ...,
    "releases_url": "..."
    "size": ...,
    "ssh_url": "..."
    "stargazers": 4,
    "stargazers_count": 4,
    "stargazers_url": "..."
    "statuses_url": "..."
    "subscribers_url": "..."
    "subscription_url": "..."
    "svn_url": "..."
    "tags_url": "..."
    "teams_url": "..."
    "trees_url": "..."
    "updated_at": "..."
    "url": "..."
    "watchers": 4,
    "watchers_count": 4
  },
  "sender": {
    "avatar_url": "..."
    "events_url": "..."
    "followers_url": "..."
    "following_url": "..."
    "gists_url": "..."
    "gravatar_id": "..."
    "html_url": "..."
    "id": ...,
    "login": "..."
    "node_id": "..."
    "organizations_url": "..."
    "received_events_url": "..."
    "repos_url": "..."
    "site_admin": false,
    "starred_url": "..."
    "subscriptions_url": "..."
    "type": "..."
    "url": "..."
  }
}

我以前也使用过阅读文档(有效)并比较了相应的webhooks,但是我找不到任何区别。

1 个答案:

答案 0 :(得分:2)

从readthedocs.org和github.com上删除该钩子,然后将其重新添加(请注意,URL的id部分已更改)解决了该问题。