Feature-request: add commit to 'push' event webhook payloads

Currently when you push a commit(s) to a repository to the non-default ref/branch, the webhook payload that is generated for the "action": "create"/"scope": "repo" event does not include any reference to the branch or commit that was pushed. This makes the event of limited use.

Can the new headSHA/commit ID of the affected branch be added to the event payload? The branch or ref name would also be useful but the SHA that was pushed is the most important missing piece.

It might look something like this:

{
  "event": {
    "action": "create",
    "scope": "repo"
  },
  "repo": {
    "type": "dataset",
    "name": "some-dataset",
    "id": <dataset-id>,
    "private": false,
    "url": {
      "web": "https://huggingface.co/datasets/my-org/some-dataset",
      "api": "https://huggingface.co/api/datasets/my-org/some-dataset"
    },
    "headSha": "72c677f213b63591bf1e6b050840ff6c2935c89a",
    "commit": "90117e736a95201f5e5921938d64423524dac95a", // new
    "branch": "some-branch" // or "ref" 
    "owner": {
      "id": <id>
    }
  },
  "webhook": {
    "id": <id>,
    "version": 3
  }
}

We can then use the API to query info about the newly pushed commit but we need the ref to do it.
If there’s a different event generated on push that has this info, happy to use it instead. But haven’t found it yet.

This doesn’t apply to pushes to the main branch, because the value of "headSha" changes on the event to reflect the latest push.

6 Likes

Hi @okmoses, thank you for your feedback. I’m cc @coyotte508 in this conversation who may be able to provide more insights

Thank you!