Artifacts 会针对仓库生命周期更改(如创建、删除、分叉/派生(fork)、导入、推送、克隆、拉取(fetch)以及令牌更改)发送结构化事件。通过事件订阅(event subscriptions)订阅这些事件,您可以在 Worker 中使用它们来构建提交驱动的自动化。
例如:
- 在创建或导入仓库时运行自定义工作流
- 当智能体(agent)推送至仓库时,启动构建并部署更改
- 在每次推送时触发审查智能体(review agent)
账户级事件 — 订阅 artifacts 源以接收您账户中任何仓库的事件。
在创建仓库时触发。
示例:
{
"type": "cf.artifacts.repo.created",
"source": {
"type": "artifacts",
"namespace": "my-namespace",
"repoName": "my-repo"
},
"payload": {
"repoId": "0tvugavnogssnwzk",
"defaultBranch": "main",
"description": "My Artifacts repository",
"readOnly": false,
"createdAt": "2026-05-18T15:53:46.833Z",
"updatedAt": "2026-05-18T15:53:46.833Z",
"lastPushAt": null
},
"metadata": {
"accountId": "f9f79265f388666de8122cfb508d7776",
"eventSubscriptionId": "1830c4bb612e43c3af7f4cada31fbf3f",
"eventSchemaVersion": 1,
"eventTimestamp": "2026-05-18T15:53:48.187Z"
}
}在删除仓库时触发。
示例:
{
"type": "cf.artifacts.repo.deleted",
"source": {
"type": "artifacts",
"namespace": "my-namespace",
"repoName": "my-repo"
},
"payload": {
"repoId": "0tvugavnogssnwzk",
"defaultBranch": "main",
"description": "My Artifacts repository",
"readOnly": false,
"createdAt": "2026-05-18T15:53:46.833Z",
"updatedAt": "2026-05-18T15:53:46.833Z",
"lastPushAt": null
},
"metadata": {
"accountId": "f9f79265f388666de8122cfb508d7776",
"eventSubscriptionId": "1830c4bb612e43c3af7f4cada31fbf3f",
"eventSchemaVersion": 1,
"eventTimestamp": "2026-05-18T15:53:59.914Z"
}
}在复刻仓库时触发。
示例:
{
"type": "cf.artifacts.repo.forked",
"source": {
"type": "artifacts",
"namespace": "source-namespace",
"repoName": "source-repo"
},
"payload": {
"namespace": "target-namespace",
"repoName": "target-repo",
"repoId": "5ankv1vhl4xnw7wq",
"defaultBranch": "main",
"description": "Fork of source-repo",
"readOnly": false,
"createdAt": "2026-05-18T15:53:52.384Z",
"updatedAt": "2026-05-18T15:53:54.579Z",
"lastPushAt": null
},
"metadata": {
"accountId": "f9f79265f388666de8122cfb508d7776",
"eventSubscriptionId": "1830c4bb612e43c3af7f4cada31fbf3f",
"eventSchemaVersion": 1,
"eventTimestamp": "2026-05-18T15:53:54.641Z"
}
}在从外部 Git 远程仓库导入仓库时触发。
示例:
{
"type": "cf.artifacts.repo.imported",
"source": {
"type": "artifacts",
"namespace": "my-namespace",
"repoName": "my-repo"
},
"payload": {
"repoId": "d7nd72k964cv9kub",
"defaultBranch": "main",
"description": null,
"readOnly": false,
"createdAt": "2026-05-18T15:53:54.864Z",
"updatedAt": "2026-05-18T15:53:57.737Z",
"lastPushAt": null,
"sourceUrl": "https://github.com/example/repo.git",
"branch": "main"
},
"metadata": {
"accountId": "f9f79265f388666de8122cfb508d7776",
"eventSubscriptionId": "1830c4bb612e43c3af7f4cada31fbf3f",
"eventSchemaVersion": 1,
"eventTimestamp": "2026-05-18T15:53:58.195Z"
}
}仓库级事件 — 订阅 artifacts.repo 源并指定 namespace 和 repo_name,以接收限定于单个仓库的事件。
在向仓库推送提交时触发。
示例:
{
"type": "cf.artifacts.repo.pushed",
"source": {
"type": "artifacts.repo",
"namespace": "my-namespace",
"repoName": "my-repo"
},
"payload": {
"ref": "refs/heads/main",
"before": "abc123def456abc123def456abc123def456abc1",
"after": "def789ghi012def789ghi012def789ghi012def7",
"commits": [
{
"id": "def789ghi012def789ghi012def789ghi012def7",
"message": "Fix bug in authentication",
"messageTruncated": false,
"timestamp": "2025-05-01T02:48:57.000Z",
"author": {
"name": "Developer Name",
"email": "developer@example.com"
},
"committer": {
"name": "Developer Name",
"email": "developer@example.com"
},
"parents": [
"abc123def456abc123def456abc123def456abc1"
]
}
],
"totalCommitsCount": 1,
"commitsTruncated": false
},
"metadata": {
"accountId": "f9f79265f388666de8122cfb508d7776",
"eventSubscriptionId": "1830c4bb612e43c3af7f4cada31fbf3f",
"eventSchemaVersion": 1,
"eventTimestamp": "2025-05-01T02:48:57.132Z"
}
}在克隆仓库时触发。
示例:
{
"type": "cf.artifacts.repo.cloned",
"source": {
"type": "artifacts.repo",
"namespace": "my-namespace",
"repoName": "my-repo"
},
"payload": {},
"metadata": {
"accountId": "f9f79265f388666de8122cfb508d7776",
"eventSubscriptionId": "0ab4c7b45a39491ba5da2973f3d093a6",
"eventSchemaVersion": 1,
"eventTimestamp": "2026-05-18T15:53:51.358Z"
}
}在从仓库获取更新时触发。
示例:
{
"type": "cf.artifacts.repo.fetched",
"source": {
"type": "artifacts.repo",
"namespace": "my-namespace",
"repoName": "my-repo"
},
"payload": {},
"metadata": {
"accountId": "f9f79265f388666de8122cfb508d7776",
"eventSubscriptionId": "0ab4c7b45a39491ba5da2973f3d093a6",
"eventSchemaVersion": 1,
"eventTimestamp": "2026-05-18T15:53:51.358Z"
}
}在创建仓库范围令牌时触发。包含令牌 ID、作用域和过期时间。
示例:
{
"type": "cf.artifacts.repo.token.created",
"source": {
"type": "artifacts.repo",
"namespace": "default",
"repoName": "token-evt-repo"
},
"payload": {
"tokenId": "7ngdf3ww3u84t33x",
"scope": "read",
"expiresAt": "2026-05-20T16:58:14.548Z"
},
"metadata": {
"accountId": "f9f79265f388666de8122cfb508d7776",
"eventSubscriptionId": "0ab4c7b45a39491ba5da2973f3d093a6",
"eventSchemaVersion": 1,
"eventTimestamp": "2026-05-20T16:58:14.548Z"
}
}在撤销仓库范围令牌时触发。包含令牌 ID。
示例:
{
"type": "cf.artifacts.repo.token.revoked",
"source": {
"type": "artifacts.repo",
"namespace": "default",
"repoName": "token-evt-repo"
},
"payload": {
"tokenId": "7ngdf3ww3u84t33x"
},
"metadata": {
"accountId": "f9f79265f388666de8122cfb508d7776",
"eventSubscriptionId": "0ab4c7b45a39491ba5da2973f3d093a6",
"eventSchemaVersion": 1,
"eventTimestamp": "2026-05-20T16:58:14.548Z"
}
}