Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion docs/hub/jobs-webhooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,12 @@ webhook = create_webhook(
)
```

The webhook triggers the Job with the webhook payload in the environment variable `WEBHOOK_PAYLOAD`.
The webhook triggers the Job with the following environment variables:

- `WEBHOOK_PAYLOAD`: the full webhook payload as a JSON string
- `WEBHOOK_REPO_ID`: the repository name (e.g., `user/repo-name`)
- `WEBHOOK_REPO_TYPE`: the repository type (`model`, `dataset`, or `space`)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

skipping for now

- `WEBHOOK_SECRET`: the webhook secret, if one was configured

The webhook payload contains multiple fields, here are a few useful ones:

Expand Down
2 changes: 1 addition & 1 deletion docs/hub/webhooks-guide-auto-retrain.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ async def post_webhook(
```python
# defined in src/models.py
class WebhookPayloadEvent(BaseModel):
action: Literal["create", "update", "delete"]
action: Literal["create", "update", "delete", "move"]
scope: str

class WebhookPayloadRepo(BaseModel):
Expand Down
13 changes: 3 additions & 10 deletions docs/hub/webhooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ As an example, here is the full payload when a Pull Request is opened:
},
"content": "Add co2 emissions information to the model card",
"hidden": false,
// Note: when `hidden` is `true`, `content` will be undefined
"url": {
"web": "https://huggingface.co/openai-community/gpt2/discussions/19#6399f58518721fdd27fc9caa"
}
Expand Down Expand Up @@ -165,21 +166,13 @@ When the top-level property `event.scope` is `"repo.config"`, the `updatedConfig
}
```

or

```json
"updatedConfig": {
"xetEnabled": true,
}
```

or, when the updated config key is not supported by the webhook:
When the updated config key is not supported by the webhook, the object will be empty:

```json
"updatedConfig": {}
```

For now only `private` and `xetEnabled` are supported. If you would benefit from more config keys being present here, please let us know at website@huggingface.co.
For now only `private` is supported. If you would benefit from more config keys being present here, please let us know at website@huggingface.co.

### Discussions and Pull Requests

Expand Down
Loading