Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add workflow_run:completed webhook, set empty client_payload for workflow_dispatch webhook #139

Merged
merged 3 commits into from
Aug 5, 2020
Merged
Show file tree
Hide file tree
Changes from 2 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
150 changes: 141 additions & 9 deletions index.json
Original file line number Diff line number Diff line change
Expand Up @@ -20593,16 +20593,13 @@
},
{
"name": "repository_dispatch",
"description": "This event occurs when a GitHub App sends a `POST` request to the \"[Create a repository dispatch event](https://docs.github.com/en/v3/repos/#create-a-repository-dispatch-event)\" endpoint.\n\nGitHub Apps must have the `contents` permission to receive this webhook.",
"description": "This event occurs when a GitHub App sends a `POST` request to the \"[Create a repository dispatch event](https://docs.github.com/en/v3/repos/#create-a-repository-dispatch-event)\" endpoint.",
Copy link
Contributor

Choose a reason for hiding this comment

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

the description is directly parsed from the website, this change will be reverted with next next automated update

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I haven't edited index.json manually – I ran bin/octokit-webhooks.js update and that's what was generated.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As far as I can see, they've recently moved this note to a separate section: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#availability-35.

"actions": ["on-demand-test"],
"examples": [
{
"action": "on-demand-test",
"branch": "master",
"client_payload": {
"unit": false,
"integration": true
},
"client_payload": {},
"repository": {
"id": 17273051,
"node_id": "MDEwOlJlcG9zaXRvcnkxNzI3MzA1MQ==",
Expand Down Expand Up @@ -20738,10 +20735,7 @@
{
"action": "on-demand-test",
"branch": "master",
"client_payload": {
"unit": false,
"integration": true
},
"client_payload": {},
"repository": {
"id": 17273051,
"node_id": "MDEwOlJlcG9zaXRvcnkxNzI3MzA1MQ==",
Expand Down Expand Up @@ -24467,5 +24461,143 @@
"workflow": ".github/workflows/hello-world-workflow.yml"
}
]
},
{
"name": "workflow_run",
"description": "When a GitHub Actions workflow run is requested or completed. For more information, see \"[Events that trigger workflows](/en/actions/reference/events-that-trigger-workflows#workflow_run).\"",
"actions": ["action"],
"examples": [
{
"action": "completed",
"organization": {
"avatar_url": "https://avatars1.githubusercontent.com/u/21031067?v=4",
"description": "",
"events_url": "https://api.github.com/orgs/Octocoders/events",
"hooks_url": "https://api.github.com/orgs/Octocoders/hooks",
"id": 33435682,
"issues_url": "https://api.github.com/orgs/Octocoders/issues",
"login": "Codertocat",
"members_url": "https://api.github.com/orgs/Octocoders/members{/member}",
"node_id": "MDQ6VXNlcjIxMDMxMDY3",
"public_members_url": "https://api.github.com/orgs/Octocoders/public_members{/member}",
"repos_url": "https://api.github.com/orgs/Octocoders/repos",
"url": "https://api.github.com/orgs/Codertocat"
},
"repository": {
"archive_url": "https://api.github.com/repos/Codertocat/Hello-World/{archive_format}{/ref}",
"archived": false,
"assignees_url": "https://api.github.com/repos/Codertocat/Hello-World/assignees{/user}",
"blobs_url": "https://api.github.com/repos/Codertocat/Hello-World/git/blobs{/sha}",
"branches_url": "https://api.github.com/repos/Codertocat/Hello-World/branches{/branch}",
"clone_url": "https://github.com/Codertocat/Hello-World.git",
"collaborators_url": "https://api.github.com/repos/Codertocat/Hello-World/collaborators{/collaborator}",
"comments_url": "https://api.github.com/repos/Codertocat/Hello-World/comments{/number}",
"commits_url": "https://api.github.com/repos/Codertocat/Hello-World/commits{/sha}",
"compare_url": "https://api.github.com/repos/Codertocat/Hello-World/compare/{base}...{head}",
"contents_url": "https://api.github.com/repos/Codertocat/Hello-World/contents/{+path}",
"contributors_url": "https://api.github.com/repos/Codertocat/Hello-World/contributors",
"created_at": "2020-07-29T09:57:16Z",
"default_branch": "main",
"deployments_url": "https://api.github.com/repos/Codertocat/Hello-World/deployments",
"description": null,
"disabled": false,
"downloads_url": "https://api.github.com/repos/Codertocat/Hello-World/downloads",
"events_url": "https://api.github.com/repos/Codertocat/Hello-World/events",
"fork": false,
"forks": 0,
"forks_count": 0,
"forks_url": "https://api.github.com/repos/Codertocat/Hello-World/forks",
"full_name": "Codertocat/Hello-World",
"git_commits_url": "https://api.github.com/repos/Codertocat/Hello-World/git/commits{/sha}",
"git_refs_url": "https://api.github.com/repos/Codertocat/Hello-World/git/refs{/sha}",
"git_tags_url": "https://api.github.com/repos/Codertocat/Hello-World/git/tags{/sha}",
"git_url": "git://github.com/Codertocat/Hello-World.git",
"has_downloads": true,
"has_issues": true,
"has_pages": false,
"has_projects": true,
"has_wiki": true,
"homepage": null,
"hooks_url": "https://api.github.com/repos/Codertocat/Hello-World/hooks",
"html_url": "https://github.com/Codertocat/Hello-World",
"id": 283462325,
"issue_comment_url": "https://api.github.com/repos/Codertocat/Hello-World/issues/comments{/number}",
"issue_events_url": "https://api.github.com/repos/Codertocat/Hello-World/issues/events{/number}",
"issues_url": "https://api.github.com/repos/Codertocat/Hello-World/issues{/number}",
"keys_url": "https://api.github.com/repos/Codertocat/Hello-World/keys{/key_id}",
"labels_url": "https://api.github.com/repos/Codertocat/Hello-World/labels{/name}",
"language": null,
"languages_url": "https://api.github.com/repos/Codertocat/Hello-World/languages",
"license": null,
"merges_url": "https://api.github.com/repos/Codertocat/Hello-World/merges",
"milestones_url": "https://api.github.com/repos/Codertocat/Hello-World/milestones{/number}",
"mirror_url": null,
"name": "Hello-World",
"node_id": "MDEwOlJlcG9zaXRvcnkyODM0NjIzMjU=",
"notifications_url": "https://api.github.com/repos/Codertocat/Hello-World/notifications{?since,all,participating}",
"open_issues": 0,
"open_issues_count": 0,
"owner": {
"avatar_url": "https://avatars1.githubusercontent.com/u/21031067?v=4",
"events_url": "https://api.github.com/users/Codertocat/events{/privacy}",
"followers_url": "https://api.github.com/users/Codertocat/followers",
"following_url": "https://api.github.com/users/Codertocat/following{/other_user}",
"gists_url": "https://api.github.com/users/Codertocat/gists{/gist_id}",
"gravatar_id": "",
"html_url": "https://github.com/Codertocat",
"id": 33435682,
"login": "Codertocat",
"node_id": "MDEyOk9yZ2FuaXphdGlvbjMzNDM1Njgy",
"organizations_url": "https://api.github.com/users/Codertocat/orgs",
"received_events_url": "https://api.github.com/users/Codertocat/received_events",
"repos_url": "https://api.github.com/users/Codertocat/repos",
"site_admin": false,
"starred_url": "https://api.github.com/users/Codertocat/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/Codertocat/subscriptions",
"type": "Organization",
"url": "https://api.github.com/users/Codertocat"
},
"private": true,
"pulls_url": "https://api.github.com/repos/Codertocat/Hello-World/pulls{/number}",
"pushed_at": "2020-07-29T10:06:16Z",
"releases_url": "https://api.github.com/repos/Codertocat/Hello-World/releases{/id}",
"size": 0,
"ssh_url": "git@github.com:Codertocat/Hello-World.git",
"stargazers_count": 0,
"stargazers_url": "https://api.github.com/repos/Codertocat/Hello-World/stargazers",
"statuses_url": "https://api.github.com/repos/Codertocat/Hello-World/statuses/{sha}",
"subscribers_url": "https://api.github.com/repos/Codertocat/Hello-World/subscribers",
"subscription_url": "https://api.github.com/repos/Codertocat/Hello-World/subscription",
"svn_url": "https://github.com/Codertocat/Hello-World",
"tags_url": "https://api.github.com/repos/Codertocat/Hello-World/tags",
"teams_url": "https://api.github.com/repos/Codertocat/Hello-World/teams",
"trees_url": "https://api.github.com/repos/Codertocat/Hello-World/git/trees{/sha}",
"updated_at": "2020-07-29T10:06:18Z",
"url": "https://api.github.com/repos/Codertocat/Hello-World",
"watchers": 0,
"watchers_count": 0
},
"sender": {
"avatar_url": "https://avatars3.githubusercontent.com/u/54248166?v=4",
"events_url": "https://api.github.com/users/Codertocat/events{/privacy}",
"followers_url": "https://api.github.com/users/Codertocat/followers",
"following_url": "https://api.github.com/users/Codertocat/following{/other_user}",
"gists_url": "https://api.github.com/users/Codertocat/gists{/gist_id}",
"gravatar_id": "",
"html_url": "https://github.com/Codertocat",
"id": 54248166,
"login": "Codertocat",
"node_id": "MDEwOkNoZWNrU3VpdGUxMTg1NzgxNDc=",
"organizations_url": "https://api.github.com/users/Codertocat/orgs",
"received_events_url": "https://api.github.com/users/Codertocat/received_events",
"repos_url": "https://api.github.com/users/Codertocat/repos",
"site_admin": true,
"starred_url": "https://api.github.com/users/Codertocat/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/Codertocat/subscriptions",
"type": "User",
"url": "https://api.github.com/users/Codertocat"
}
}
]
}
]
6 changes: 6 additions & 0 deletions lib/workarounds.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ module.exports = workarounds;

function workarounds(webhooks) {
webhooks.forEach((webhook) => {
if (webhook.name === "repository_dispatch") {
webhook.examples.forEach((example) => {
example.client_payload = {};
});
}

if (webhook.name === "workflow_dispatch") {
webhook.examples.forEach((example) => {
example.inputs = {};
Expand Down