Closed h1alexbel closed 10 months ago
This is the example of GitHub webhook:
{
"ref": "refs/heads/master",
"before": "3f3ece4b4fdf562dc68a7bedad0e7de19a6d4e5e",
"after": "cc931a05d3fb75ba34ce62cc41f169b56987d986",
"repository": {
"id": 741957352,
"node_id": "R_kgDOLDle6A",
"name": "tracehub",
"full_name": "tracehubpm/tracehub",
"private": true,
"owner": {
"name": "tracehubpm",
"email": null,
"login": "tracehubpm",
"id": 146234005,
"node_id": "O_kgDOCLdalQ",
"avatar_url": "https://avatars.githubusercontent.com/u/146234005?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/tracehubpm",
"html_url": "https://github.com/tracehubpm",
"followers_url": "https://api.github.com/users/tracehubpm/followers",
"following_url": "https://api.github.com/users/tracehubpm/following{/other_user}",
"gists_url": "https://api.github.com/users/tracehubpm/gists{/gist_id}",
"starred_url": "https://api.github.com/users/tracehubpm/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/tracehubpm/subscriptions",
"organizations_url": "https://api.github.com/users/tracehubpm/orgs",
"repos_url": "https://api.github.com/users/tracehubpm/repos",
"events_url": "https://api.github.com/users/tracehubpm/events{/privacy}",
"received_events_url": "https://api.github.com/users/tracehubpm/received_events",
"type": "Organization",
"site_admin": false
},
"html_url": "https://github.com/tracehubpm/tracehub",
"description": "Tracehub and Project as a Code, a VCS-based collaboration tool",
"fork": false,
"url": "https://github.com/tracehubpm/tracehub",
"forks_url": "https://api.github.com/repos/tracehubpm/tracehub/forks",
"keys_url": "https://api.github.com/repos/tracehubpm/tracehub/keys{/key_id}",
"collaborators_url": "https://api.github.com/repos/tracehubpm/tracehub/collaborators{/collaborator}",
"teams_url": "https://api.github.com/repos/tracehubpm/tracehub/teams",
"hooks_url": "https://api.github.com/repos/tracehubpm/tracehub/hooks",
"issue_events_url": "https://api.github.com/repos/tracehubpm/tracehub/issues/events{/number}",
"events_url": "https://api.github.com/repos/tracehubpm/tracehub/events",
"assignees_url": "https://api.github.com/repos/tracehubpm/tracehub/assignees{/user}",
"branches_url": "https://api.github.com/repos/tracehubpm/tracehub/branches{/branch}",
"tags_url": "https://api.github.com/repos/tracehubpm/tracehub/tags",
"blobs_url": "https://api.github.com/repos/tracehubpm/tracehub/git/blobs{/sha}",
"git_tags_url": "https://api.github.com/repos/tracehubpm/tracehub/git/tags{/sha}",
"git_refs_url": "https://api.github.com/repos/tracehubpm/tracehub/git/refs{/sha}",
"trees_url": "https://api.github.com/repos/tracehubpm/tracehub/git/trees{/sha}",
"statuses_url": "https://api.github.com/repos/tracehubpm/tracehub/statuses/{sha}",
"languages_url": "https://api.github.com/repos/tracehubpm/tracehub/languages",
"stargazers_url": "https://api.github.com/repos/tracehubpm/tracehub/stargazers",
"contributors_url": "https://api.github.com/repos/tracehubpm/tracehub/contributors",
"subscribers_url": "https://api.github.com/repos/tracehubpm/tracehub/subscribers",
"subscription_url": "https://api.github.com/repos/tracehubpm/tracehub/subscription",
"commits_url": "https://api.github.com/repos/tracehubpm/tracehub/commits{/sha}",
"git_commits_url": "https://api.github.com/repos/tracehubpm/tracehub/git/commits{/sha}",
"comments_url": "https://api.github.com/repos/tracehubpm/tracehub/comments{/number}",
"issue_comment_url": "https://api.github.com/repos/tracehubpm/tracehub/issues/comments{/number}",
"contents_url": "https://api.github.com/repos/tracehubpm/tracehub/contents/{+path}",
"compare_url": "https://api.github.com/repos/tracehubpm/tracehub/compare/{base}...{head}",
"merges_url": "https://api.github.com/repos/tracehubpm/tracehub/merges",
"archive_url": "https://api.github.com/repos/tracehubpm/tracehub/{archive_format}{/ref}",
"downloads_url": "https://api.github.com/repos/tracehubpm/tracehub/downloads",
"issues_url": "https://api.github.com/repos/tracehubpm/tracehub/issues{/number}",
"pulls_url": "https://api.github.com/repos/tracehubpm/tracehub/pulls{/number}",
"milestones_url": "https://api.github.com/repos/tracehubpm/tracehub/milestones{/number}",
"notifications_url": "https://api.github.com/repos/tracehubpm/tracehub/notifications{?since,all,participating}",
"labels_url": "https://api.github.com/repos/tracehubpm/tracehub/labels{/name}",
"releases_url": "https://api.github.com/repos/tracehubpm/tracehub/releases{/id}",
"deployments_url": "https://api.github.com/repos/tracehubpm/tracehub/deployments",
"created_at": 1704978898,
"updated_at": "2024-01-12T13:47:35Z",
"pushed_at": 1705067831,
"git_url": "git://github.com/tracehubpm/tracehub.git",
"ssh_url": "git@github.com:tracehubpm/tracehub.git",
"clone_url": "https://github.com/tracehubpm/tracehub.git",
"svn_url": "https://github.com/tracehubpm/tracehub",
"homepage": "",
"size": 36,
"stargazers_count": 3,
"watchers_count": 3,
"language": "Java",
"has_issues": true,
"has_projects": true,
"has_downloads": true,
"has_wiki": false,
"has_pages": false,
"has_discussions": false,
"forks_count": 0,
"mirror_url": null,
"archived": false,
"disabled": false,
"open_issues_count": 4,
"license": {
"key": "mit",
"name": "MIT License",
"spdx_id": "MIT",
"url": "https://api.github.com/licenses/mit",
"node_id": "MDc6TGljZW5zZTEz"
},
"allow_forking": false,
"is_template": false,
"web_commit_signoff_required": false,
"topics": [
"chatbot",
"java",
"pmi",
"project-as-a-code",
"version-control",
"yaml"
],
"visibility": "private",
"forks": 0,
"open_issues": 4,
"watchers": 3,
"default_branch": "master",
"stargazers": 3,
"master_branch": "master",
"organization": "tracehubpm",
"custom_properties": {
}
},
"pusher": {
"name": "rultor",
"email": "me@rultor.com"
},
"organization": {
"login": "tracehubpm",
"id": 146234005,
"node_id": "O_kgDOCLdalQ",
"url": "https://api.github.com/orgs/tracehubpm",
"repos_url": "https://api.github.com/orgs/tracehubpm/repos",
"events_url": "https://api.github.com/orgs/tracehubpm/events",
"hooks_url": "https://api.github.com/orgs/tracehubpm/hooks",
"issues_url": "https://api.github.com/orgs/tracehubpm/issues",
"members_url": "https://api.github.com/orgs/tracehubpm/members{/member}",
"public_members_url": "https://api.github.com/orgs/tracehubpm/public_members{/member}",
"avatar_url": "https://avatars.githubusercontent.com/u/146234005?v=4",
"description": ""
},
"sender": {
"login": "rultor",
"id": 8086956,
"node_id": "MDQ6VXNlcjgwODY5NTY=",
"avatar_url": "https://avatars.githubusercontent.com/u/8086956?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/rultor",
"html_url": "https://github.com/rultor",
"followers_url": "https://api.github.com/users/rultor/followers",
"following_url": "https://api.github.com/users/rultor/following{/other_user}",
"gists_url": "https://api.github.com/users/rultor/gists{/gist_id}",
"starred_url": "https://api.github.com/users/rultor/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/rultor/subscriptions",
"organizations_url": "https://api.github.com/users/rultor/orgs",
"repos_url": "https://api.github.com/users/rultor/repos",
"events_url": "https://api.github.com/users/rultor/events{/privacy}",
"received_events_url": "https://api.github.com/users/rultor/received_events",
"type": "User",
"site_admin": false
},
"created": false,
"deleted": false,
"forced": false,
"base_ref": "refs/heads/github-start",
"compare": "https://github.com/tracehubpm/tracehub/compare/3f3ece4b4fdf...cc931a05d3fb",
"commits": [
{
"id": "1044ba8d894b2b7c557869e3afeaf51adf44febe",
"tree_id": "4ddd15304b59edea9e1c578b2073da3e2466f973",
"distinct": false,
"message": "github agent start",
"timestamp": "2024-01-12T16:39:54+03:00",
"url": "https://github.com/tracehubpm/tracehub/commit/1044ba8d894b2b7c557869e3afeaf51adf44febe",
"author": {
"name": "h1alexbel",
"email": "hialexbel@gmail.com",
"username": "h1alexbel"
},
"committer": {
"name": "h1alexbel",
"email": "hialexbel@gmail.com",
"username": "h1alexbel"
},
"added": [
"src/main/java/git/tracehub/agents/Act.java",
"src/main/java/git/tracehub/agents/Job.java",
"src/main/java/git/tracehub/agents/Project.java",
"src/main/java/git/tracehub/agents/github/GhContent.java",
"src/main/java/git/tracehub/agents/github/GhYamlJob.java",
"src/main/java/git/tracehub/agents/github/GhYamlProject.java",
"src/main/java/git/tracehub/identity/GhIdentity.java",
"src/main/resources/META-INF/MANIFEST.MF",
"src/test/java/git/tracehub/agents/github/GhYamlProjectTest.java",
"src/test/java/git/tracehub/identity/GhIdentityTest.java"
],
"removed": [
],
"modified": [
"pom.xml"
]
},
{
"id": "8897172479f9f43daf78acede55d361b61caeb26",
"tree_id": "321cb18d24cfc13b8d9f557af786265b5c9cc610",
"distinct": false,
"message": "github agent start",
"timestamp": "2024-01-12T16:40:03+03:00",
"url": "https://github.com/tracehubpm/tracehub/commit/8897172479f9f43daf78acede55d361b61caeb26",
"author": {
"name": "h1alexbel",
"email": "hialexbel@gmail.com",
"username": "h1alexbel"
},
"committer": {
"name": "h1alexbel",
"email": "hialexbel@gmail.com",
"username": "h1alexbel"
},
"added": [
"src/main/java/git/tracehub/agents/github/Invites.java"
],
"removed": [
],
"modified": [
]
},
{
"id": "cc931a05d3fb75ba34ce62cc41f169b56987d986",
"tree_id": "44c413638aede960d56824e728ec9a26e26eefcd",
"distinct": false,
"message": "packages",
"timestamp": "2024-01-12T16:42:43+03:00",
"url": "https://github.com/tracehubpm/tracehub/commit/cc931a05d3fb75ba34ce62cc41f169b56987d986",
"author": {
"name": "h1alexbel",
"email": "hialexbel@gmail.com",
"username": "h1alexbel"
},
"committer": {
"name": "h1alexbel",
"email": "hialexbel@gmail.com",
"username": "h1alexbel"
},
"added": [
"src/main/java/git/tracehub/agents/github/package-info.java",
"src/main/java/git/tracehub/agents/package-info.java",
"src/main/java/git/tracehub/identity/package-info.java",
"src/test/java/git/tracehub/agents/github/package-info.java",
"src/test/java/git/tracehub/identity/package-info.java"
],
"removed": [
],
"modified": [
]
}
],
"head_commit": {
"id": "cc931a05d3fb75ba34ce62cc41f169b56987d986",
"tree_id": "44c413638aede960d56824e728ec9a26e26eefcd",
"distinct": false,
"message": "packages",
"timestamp": "2024-01-12T16:42:43+03:00",
"url": "https://github.com/tracehubpm/tracehub/commit/cc931a05d3fb75ba34ce62cc41f169b56987d986",
"author": {
"name": "h1alexbel",
"email": "hialexbel@gmail.com",
"username": "h1alexbel"
},
"committer": {
"name": "h1alexbel",
"email": "hialexbel@gmail.com",
"username": "h1alexbel"
},
"added": [
"src/main/java/git/tracehub/agents/github/package-info.java",
"src/main/java/git/tracehub/agents/package-info.java",
"src/main/java/git/tracehub/identity/package-info.java",
"src/test/java/git/tracehub/agents/github/package-info.java",
"src/test/java/git/tracehub/identity/package-info.java"
],
"removed": [
],
"modified": [
]
}
}
We should parse webhook coming from GitHub. We need these data: