mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-11-23 02:11:01 +00:00
Merge pull request #1314 from adamstep/fix_pr_author
Set Build Author from Github Pull Request User
This commit is contained in:
commit
9b2a9e6124
3 changed files with 472 additions and 2 deletions
423
remote/github/fixtures/pull_request.json
Normal file
423
remote/github/fixtures/pull_request.json
Normal file
|
@ -0,0 +1,423 @@
|
|||
{
|
||||
"action": "opened",
|
||||
"number": 773,
|
||||
"pull_request": {
|
||||
"url": "https://api.github.com/repos/company/project/pulls/773",
|
||||
"id": 50420217,
|
||||
"html_url": "https://github.com/company/project/pull/773",
|
||||
"diff_url": "https://github.com/company/project/pull/773.diff",
|
||||
"patch_url": "https://github.com/company/project/pull/773.patch",
|
||||
"issue_url": "https://api.github.com/repos/company/project/issues/773",
|
||||
"number": 773,
|
||||
"state": "open",
|
||||
"locked": false,
|
||||
"title": "working on feature X",
|
||||
"user": {
|
||||
"login": "author",
|
||||
"id": 55555,
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/55555?v=3",
|
||||
"gravatar_id": "",
|
||||
"url": "https://api.github.com/users/author",
|
||||
"html_url": "https://github.com/author",
|
||||
"followers_url": "https://api.github.com/users/author/followers",
|
||||
"following_url": "https://api.github.com/users/author/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/author/gists{/gist_id}",
|
||||
"starred_url": "https://api.github.com/users/author/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/author/subscriptions",
|
||||
"organizations_url": "https://api.github.com/users/author/orgs",
|
||||
"repos_url": "https://api.github.com/users/author/repos",
|
||||
"events_url": "https://api.github.com/users/author/events{/privacy}",
|
||||
"received_events_url": "https://api.github.com/users/author/received_events",
|
||||
"type": "User",
|
||||
"site_admin": false
|
||||
},
|
||||
"body": "Check that the server builds without errors.",
|
||||
"created_at": "2015-11-11T18:48:59Z",
|
||||
"updated_at": "2015-11-11T18:48:59Z",
|
||||
"closed_at": null,
|
||||
"merged_at": null,
|
||||
"merge_commit_sha": "a628859c51125d68cdf8db83e1a8d71b42a3aa55",
|
||||
"assignee": null,
|
||||
"milestone": null,
|
||||
"commits_url": "https://api.github.com/repos/company/project/pulls/773/commits",
|
||||
"review_comments_url": "https://api.github.com/repos/company/project/pulls/773/comments",
|
||||
"review_comment_url": "https://api.github.com/repos/company/project/pulls/comments{/number}",
|
||||
"comments_url": "https://api.github.com/repos/company/project/issues/773/comments",
|
||||
"statuses_url": "https://api.github.com/repos/company/project/statuses/f2fe6d044518f607bf61d621200834643e364841",
|
||||
"head": {
|
||||
"label": "company:feature_branch",
|
||||
"ref": "feature_branch",
|
||||
"sha": "f2fe6d044518f607bf61d621200834643e364841",
|
||||
"user": {
|
||||
"login": "company",
|
||||
"id": 66666,
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/66666?v=3",
|
||||
"gravatar_id": "",
|
||||
"url": "https://api.github.com/users/company",
|
||||
"html_url": "https://github.com/company",
|
||||
"followers_url": "https://api.github.com/users/company/followers",
|
||||
"following_url": "https://api.github.com/users/company/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/company/gists{/gist_id}",
|
||||
"starred_url": "https://api.github.com/users/company/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/company/subscriptions",
|
||||
"organizations_url": "https://api.github.com/users/company/orgs",
|
||||
"repos_url": "https://api.github.com/users/company/repos",
|
||||
"events_url": "https://api.github.com/users/company/events{/privacy}",
|
||||
"received_events_url": "https://api.github.com/users/company/received_events",
|
||||
"type": "Organization",
|
||||
"site_admin": false
|
||||
},
|
||||
"repo": {
|
||||
"id": 13249623,
|
||||
"name": "project",
|
||||
"full_name": "company/project",
|
||||
"owner": {
|
||||
"login": "company",
|
||||
"id": 66666,
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/66666?v=3",
|
||||
"gravatar_id": "",
|
||||
"url": "https://api.github.com/users/company",
|
||||
"html_url": "https://github.com/company",
|
||||
"followers_url": "https://api.github.com/users/company/followers",
|
||||
"following_url": "https://api.github.com/users/company/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/company/gists{/gist_id}",
|
||||
"starred_url": "https://api.github.com/users/company/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/company/subscriptions",
|
||||
"organizations_url": "https://api.github.com/users/company/orgs",
|
||||
"repos_url": "https://api.github.com/users/company/repos",
|
||||
"events_url": "https://api.github.com/users/company/events{/privacy}",
|
||||
"received_events_url": "https://api.github.com/users/company/received_events",
|
||||
"type": "Organization",
|
||||
"site_admin": false
|
||||
},
|
||||
"private": true,
|
||||
"html_url": "https://github.com/company/project",
|
||||
"description": "project description",
|
||||
"fork": false,
|
||||
"url": "https://api.github.com/repos/company/project",
|
||||
"forks_url": "https://api.github.com/repos/company/project/forks",
|
||||
"keys_url": "https://api.github.com/repos/company/project/keys{/key_id}",
|
||||
"collaborators_url": "https://api.github.com/repos/company/project/collaborators{/collaborator}",
|
||||
"teams_url": "https://api.github.com/repos/company/project/teams",
|
||||
"hooks_url": "https://api.github.com/repos/company/project/hooks",
|
||||
"issue_events_url": "https://api.github.com/repos/company/project/issues/events{/number}",
|
||||
"events_url": "https://api.github.com/repos/company/project/events",
|
||||
"assignees_url": "https://api.github.com/repos/company/project/assignees{/user}",
|
||||
"branches_url": "https://api.github.com/repos/company/project/branches{/branch}",
|
||||
"tags_url": "https://api.github.com/repos/company/project/tags",
|
||||
"blobs_url": "https://api.github.com/repos/company/project/git/blobs{/sha}",
|
||||
"git_tags_url": "https://api.github.com/repos/company/project/git/tags{/sha}",
|
||||
"git_refs_url": "https://api.github.com/repos/company/project/git/refs{/sha}",
|
||||
"trees_url": "https://api.github.com/repos/company/project/git/trees{/sha}",
|
||||
"statuses_url": "https://api.github.com/repos/company/project/statuses/{sha}",
|
||||
"languages_url": "https://api.github.com/repos/company/project/languages",
|
||||
"stargazers_url": "https://api.github.com/repos/company/project/stargazers",
|
||||
"contributors_url": "https://api.github.com/repos/company/project/contributors",
|
||||
"subscribers_url": "https://api.github.com/repos/company/project/subscribers",
|
||||
"subscription_url": "https://api.github.com/repos/company/project/subscription",
|
||||
"commits_url": "https://api.github.com/repos/company/project/commits{/sha}",
|
||||
"git_commits_url": "https://api.github.com/repos/company/project/git/commits{/sha}",
|
||||
"comments_url": "https://api.github.com/repos/company/project/comments{/number}",
|
||||
"issue_comment_url": "https://api.github.com/repos/company/project/issues/comments{/number}",
|
||||
"contents_url": "https://api.github.com/repos/company/project/contents/{+path}",
|
||||
"compare_url": "https://api.github.com/repos/company/project/compare/{base}...{head}",
|
||||
"merges_url": "https://api.github.com/repos/company/project/merges",
|
||||
"archive_url": "https://api.github.com/repos/company/project/{archive_format}{/ref}",
|
||||
"downloads_url": "https://api.github.com/repos/company/project/downloads",
|
||||
"issues_url": "https://api.github.com/repos/company/project/issues{/number}",
|
||||
"pulls_url": "https://api.github.com/repos/company/project/pulls{/number}",
|
||||
"milestones_url": "https://api.github.com/repos/company/project/milestones{/number}",
|
||||
"notifications_url": "https://api.github.com/repos/company/project/notifications{?since,all,participating}",
|
||||
"labels_url": "https://api.github.com/repos/company/project/labels{/name}",
|
||||
"releases_url": "https://api.github.com/repos/company/project/releases{/id}",
|
||||
"created_at": "2013-10-01T16:47:20Z",
|
||||
"updated_at": "2015-05-08T20:19:10Z",
|
||||
"pushed_at": "2015-11-11T18:48:59Z",
|
||||
"git_url": "git://github.com/company/project.git",
|
||||
"ssh_url": "git@github.com:company/project.git",
|
||||
"clone_url": "https://github.com/company/project.git",
|
||||
"svn_url": "https://github.com/company/project",
|
||||
"homepage": "",
|
||||
"size": 21672,
|
||||
"stargazers_count": 1,
|
||||
"watchers_count": 1,
|
||||
"language": "Go",
|
||||
"has_issues": true,
|
||||
"has_downloads": true,
|
||||
"has_wiki": true,
|
||||
"has_pages": false,
|
||||
"forks_count": 0,
|
||||
"mirror_url": null,
|
||||
"open_issues_count": 2,
|
||||
"forks": 0,
|
||||
"open_issues": 2,
|
||||
"watchers": 1,
|
||||
"default_branch": "master"
|
||||
}
|
||||
},
|
||||
"base": {
|
||||
"label": "company:master",
|
||||
"ref": "master",
|
||||
"sha": "19f3077e1c7e490247a8f4a563148a7f60ae03fa",
|
||||
"user": {
|
||||
"login": "company",
|
||||
"id": 66666,
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/66666?v=3",
|
||||
"gravatar_id": "",
|
||||
"url": "https://api.github.com/users/company",
|
||||
"html_url": "https://github.com/company",
|
||||
"followers_url": "https://api.github.com/users/company/followers",
|
||||
"following_url": "https://api.github.com/users/company/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/company/gists{/gist_id}",
|
||||
"starred_url": "https://api.github.com/users/company/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/company/subscriptions",
|
||||
"organizations_url": "https://api.github.com/users/company/orgs",
|
||||
"repos_url": "https://api.github.com/users/company/repos",
|
||||
"events_url": "https://api.github.com/users/company/events{/privacy}",
|
||||
"received_events_url": "https://api.github.com/users/company/received_events",
|
||||
"type": "Organization",
|
||||
"site_admin": false
|
||||
},
|
||||
"repo": {
|
||||
"id": 13249623,
|
||||
"name": "project",
|
||||
"full_name": "company/project",
|
||||
"owner": {
|
||||
"login": "company",
|
||||
"id": 66666,
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/66666?v=3",
|
||||
"gravatar_id": "",
|
||||
"url": "https://api.github.com/users/company",
|
||||
"html_url": "https://github.com/company",
|
||||
"followers_url": "https://api.github.com/users/company/followers",
|
||||
"following_url": "https://api.github.com/users/company/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/company/gists{/gist_id}",
|
||||
"starred_url": "https://api.github.com/users/company/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/company/subscriptions",
|
||||
"organizations_url": "https://api.github.com/users/company/orgs",
|
||||
"repos_url": "https://api.github.com/users/company/repos",
|
||||
"events_url": "https://api.github.com/users/company/events{/privacy}",
|
||||
"received_events_url": "https://api.github.com/users/company/received_events",
|
||||
"type": "Organization",
|
||||
"site_admin": false
|
||||
},
|
||||
"private": true,
|
||||
"html_url": "https://github.com/company/project",
|
||||
"description": "project description",
|
||||
"fork": false,
|
||||
"url": "https://api.github.com/repos/company/project",
|
||||
"forks_url": "https://api.github.com/repos/company/project/forks",
|
||||
"keys_url": "https://api.github.com/repos/company/project/keys{/key_id}",
|
||||
"collaborators_url": "https://api.github.com/repos/company/project/collaborators{/collaborator}",
|
||||
"teams_url": "https://api.github.com/repos/company/project/teams",
|
||||
"hooks_url": "https://api.github.com/repos/company/project/hooks",
|
||||
"issue_events_url": "https://api.github.com/repos/company/project/issues/events{/number}",
|
||||
"events_url": "https://api.github.com/repos/company/project/events",
|
||||
"assignees_url": "https://api.github.com/repos/company/project/assignees{/user}",
|
||||
"branches_url": "https://api.github.com/repos/company/project/branches{/branch}",
|
||||
"tags_url": "https://api.github.com/repos/company/project/tags",
|
||||
"blobs_url": "https://api.github.com/repos/company/project/git/blobs{/sha}",
|
||||
"git_tags_url": "https://api.github.com/repos/company/project/git/tags{/sha}",
|
||||
"git_refs_url": "https://api.github.com/repos/company/project/git/refs{/sha}",
|
||||
"trees_url": "https://api.github.com/repos/company/project/git/trees{/sha}",
|
||||
"statuses_url": "https://api.github.com/repos/company/project/statuses/{sha}",
|
||||
"languages_url": "https://api.github.com/repos/company/project/languages",
|
||||
"stargazers_url": "https://api.github.com/repos/company/project/stargazers",
|
||||
"contributors_url": "https://api.github.com/repos/company/project/contributors",
|
||||
"subscribers_url": "https://api.github.com/repos/company/project/subscribers",
|
||||
"subscription_url": "https://api.github.com/repos/company/project/subscription",
|
||||
"commits_url": "https://api.github.com/repos/company/project/commits{/sha}",
|
||||
"git_commits_url": "https://api.github.com/repos/company/project/git/commits{/sha}",
|
||||
"comments_url": "https://api.github.com/repos/company/project/comments{/number}",
|
||||
"issue_comment_url": "https://api.github.com/repos/company/project/issues/comments{/number}",
|
||||
"contents_url": "https://api.github.com/repos/company/project/contents/{+path}",
|
||||
"compare_url": "https://api.github.com/repos/company/project/compare/{base}...{head}",
|
||||
"merges_url": "https://api.github.com/repos/company/project/merges",
|
||||
"archive_url": "https://api.github.com/repos/company/project/{archive_format}{/ref}",
|
||||
"downloads_url": "https://api.github.com/repos/company/project/downloads",
|
||||
"issues_url": "https://api.github.com/repos/company/project/issues{/number}",
|
||||
"pulls_url": "https://api.github.com/repos/company/project/pulls{/number}",
|
||||
"milestones_url": "https://api.github.com/repos/company/project/milestones{/number}",
|
||||
"notifications_url": "https://api.github.com/repos/company/project/notifications{?since,all,participating}",
|
||||
"labels_url": "https://api.github.com/repos/company/project/labels{/name}",
|
||||
"releases_url": "https://api.github.com/repos/company/project/releases{/id}",
|
||||
"created_at": "2013-10-01T16:47:20Z",
|
||||
"updated_at": "2015-05-08T20:19:10Z",
|
||||
"pushed_at": "2015-11-11T18:48:59Z",
|
||||
"git_url": "git://github.com/company/project.git",
|
||||
"ssh_url": "git@github.com:company/project.git",
|
||||
"clone_url": "https://github.com/company/project.git",
|
||||
"svn_url": "https://github.com/company/project",
|
||||
"homepage": "",
|
||||
"size": 21672,
|
||||
"stargazers_count": 1,
|
||||
"watchers_count": 1,
|
||||
"language": "Go",
|
||||
"has_issues": true,
|
||||
"has_downloads": true,
|
||||
"has_wiki": true,
|
||||
"has_pages": false,
|
||||
"forks_count": 0,
|
||||
"mirror_url": null,
|
||||
"open_issues_count": 2,
|
||||
"forks": 0,
|
||||
"open_issues": 2,
|
||||
"watchers": 1,
|
||||
"default_branch": "master"
|
||||
}
|
||||
},
|
||||
"_links": {
|
||||
"self": {
|
||||
"href": "https://api.github.com/repos/company/project/pulls/773"
|
||||
},
|
||||
"html": {
|
||||
"href": "https://github.com/company/project/pull/773"
|
||||
},
|
||||
"issue": {
|
||||
"href": "https://api.github.com/repos/company/project/issues/773"
|
||||
},
|
||||
"comments": {
|
||||
"href": "https://api.github.com/repos/company/project/issues/773/comments"
|
||||
},
|
||||
"review_comments": {
|
||||
"href": "https://api.github.com/repos/company/project/pulls/773/comments"
|
||||
},
|
||||
"review_comment": {
|
||||
"href": "https://api.github.com/repos/company/project/pulls/comments{/number}"
|
||||
},
|
||||
"commits": {
|
||||
"href": "https://api.github.com/repos/company/project/pulls/773/commits"
|
||||
},
|
||||
"statuses": {
|
||||
"href": "https://api.github.com/repos/company/project/statuses/f2fe6d044518f607bf61d621200834643e364841"
|
||||
}
|
||||
},
|
||||
"merged": false,
|
||||
"mergeable": true,
|
||||
"mergeable_state": "clean",
|
||||
"merged_by": null,
|
||||
"comments": 0,
|
||||
"review_comments": 0,
|
||||
"commits": 1,
|
||||
"additions": 1,
|
||||
"deletions": 0,
|
||||
"changed_files": 1
|
||||
},
|
||||
"repository": {
|
||||
"id": 13249623,
|
||||
"name": "project",
|
||||
"full_name": "company/project",
|
||||
"owner": {
|
||||
"login": "company",
|
||||
"id": 66666,
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/66666?v=3",
|
||||
"gravatar_id": "",
|
||||
"url": "https://api.github.com/users/company",
|
||||
"html_url": "https://github.com/company",
|
||||
"followers_url": "https://api.github.com/users/company/followers",
|
||||
"following_url": "https://api.github.com/users/company/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/company/gists{/gist_id}",
|
||||
"starred_url": "https://api.github.com/users/company/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/company/subscriptions",
|
||||
"organizations_url": "https://api.github.com/users/company/orgs",
|
||||
"repos_url": "https://api.github.com/users/company/repos",
|
||||
"events_url": "https://api.github.com/users/company/events{/privacy}",
|
||||
"received_events_url": "https://api.github.com/users/company/received_events",
|
||||
"type": "Organization",
|
||||
"site_admin": false
|
||||
},
|
||||
"private": true,
|
||||
"html_url": "https://github.com/company/project",
|
||||
"description": "project description",
|
||||
"fork": false,
|
||||
"url": "https://api.github.com/repos/company/project",
|
||||
"forks_url": "https://api.github.com/repos/company/project/forks",
|
||||
"keys_url": "https://api.github.com/repos/company/project/keys{/key_id}",
|
||||
"collaborators_url": "https://api.github.com/repos/company/project/collaborators{/collaborator}",
|
||||
"teams_url": "https://api.github.com/repos/company/project/teams",
|
||||
"hooks_url": "https://api.github.com/repos/company/project/hooks",
|
||||
"issue_events_url": "https://api.github.com/repos/company/project/issues/events{/number}",
|
||||
"events_url": "https://api.github.com/repos/company/project/events",
|
||||
"assignees_url": "https://api.github.com/repos/company/project/assignees{/user}",
|
||||
"branches_url": "https://api.github.com/repos/company/project/branches{/branch}",
|
||||
"tags_url": "https://api.github.com/repos/company/project/tags",
|
||||
"blobs_url": "https://api.github.com/repos/company/project/git/blobs{/sha}",
|
||||
"git_tags_url": "https://api.github.com/repos/company/project/git/tags{/sha}",
|
||||
"git_refs_url": "https://api.github.com/repos/company/project/git/refs{/sha}",
|
||||
"trees_url": "https://api.github.com/repos/company/project/git/trees{/sha}",
|
||||
"statuses_url": "https://api.github.com/repos/company/project/statuses/{sha}",
|
||||
"languages_url": "https://api.github.com/repos/company/project/languages",
|
||||
"stargazers_url": "https://api.github.com/repos/company/project/stargazers",
|
||||
"contributors_url": "https://api.github.com/repos/company/project/contributors",
|
||||
"subscribers_url": "https://api.github.com/repos/company/project/subscribers",
|
||||
"subscription_url": "https://api.github.com/repos/company/project/subscription",
|
||||
"commits_url": "https://api.github.com/repos/company/project/commits{/sha}",
|
||||
"git_commits_url": "https://api.github.com/repos/company/project/git/commits{/sha}",
|
||||
"comments_url": "https://api.github.com/repos/company/project/comments{/number}",
|
||||
"issue_comment_url": "https://api.github.com/repos/company/project/issues/comments{/number}",
|
||||
"contents_url": "https://api.github.com/repos/company/project/contents/{+path}",
|
||||
"compare_url": "https://api.github.com/repos/company/project/compare/{base}...{head}",
|
||||
"merges_url": "https://api.github.com/repos/company/project/merges",
|
||||
"archive_url": "https://api.github.com/repos/company/project/{archive_format}{/ref}",
|
||||
"downloads_url": "https://api.github.com/repos/company/project/downloads",
|
||||
"issues_url": "https://api.github.com/repos/company/project/issues{/number}",
|
||||
"pulls_url": "https://api.github.com/repos/company/project/pulls{/number}",
|
||||
"milestones_url": "https://api.github.com/repos/company/project/milestones{/number}",
|
||||
"notifications_url": "https://api.github.com/repos/company/project/notifications{?since,all,participating}",
|
||||
"labels_url": "https://api.github.com/repos/company/project/labels{/name}",
|
||||
"releases_url": "https://api.github.com/repos/company/project/releases{/id}",
|
||||
"created_at": "2013-10-01T16:47:20Z",
|
||||
"updated_at": "2015-05-08T20:19:10Z",
|
||||
"pushed_at": "2015-11-11T18:48:59Z",
|
||||
"git_url": "git://github.com/company/project.git",
|
||||
"ssh_url": "git@github.com:company/project.git",
|
||||
"clone_url": "https://github.com/company/project.git",
|
||||
"svn_url": "https://github.com/company/project",
|
||||
"homepage": "",
|
||||
"size": 21672,
|
||||
"stargazers_count": 1,
|
||||
"watchers_count": 1,
|
||||
"language": "Go",
|
||||
"has_issues": true,
|
||||
"has_downloads": true,
|
||||
"has_wiki": true,
|
||||
"has_pages": false,
|
||||
"forks_count": 0,
|
||||
"mirror_url": null,
|
||||
"open_issues_count": 2,
|
||||
"forks": 0,
|
||||
"open_issues": 2,
|
||||
"watchers": 1,
|
||||
"default_branch": "master"
|
||||
},
|
||||
"organization": {
|
||||
"login": "company",
|
||||
"id": 66666,
|
||||
"url": "https://api.github.com/orgs/company",
|
||||
"repos_url": "https://api.github.com/orgs/company/repos",
|
||||
"events_url": "https://api.github.com/orgs/company/events",
|
||||
"members_url": "https://api.github.com/orgs/company/members{/member}",
|
||||
"public_members_url": "https://api.github.com/orgs/company/public_members{/member}",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/66666?v=3",
|
||||
"description": null
|
||||
},
|
||||
"sender": {
|
||||
"login": "author",
|
||||
"id": 55555,
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/55555?v=3",
|
||||
"gravatar_id": "",
|
||||
"url": "https://api.github.com/users/author",
|
||||
"html_url": "https://github.com/author",
|
||||
"followers_url": "https://api.github.com/users/author/followers",
|
||||
"following_url": "https://api.github.com/users/author/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/author/gists{/gist_id}",
|
||||
"starred_url": "https://api.github.com/users/author/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/author/subscriptions",
|
||||
"organizations_url": "https://api.github.com/users/author/orgs",
|
||||
"repos_url": "https://api.github.com/users/author/repos",
|
||||
"events_url": "https://api.github.com/users/author/events{/privacy}",
|
||||
"received_events_url": "https://api.github.com/users/author/received_events",
|
||||
"type": "User",
|
||||
"site_admin": false
|
||||
}
|
||||
}
|
|
@ -410,8 +410,8 @@ func (g *Github) pullRequest(r *http.Request) (*model.Repo, *model.Build, error)
|
|||
build.Link = *hook.PullRequest.HTMLURL
|
||||
build.Branch = *hook.PullRequest.Head.Ref
|
||||
build.Message = *hook.PullRequest.Title
|
||||
build.Author = *hook.PullRequest.Head.User.Login
|
||||
build.Avatar = *hook.PullRequest.Head.User.AvatarURL
|
||||
build.Author = *hook.PullRequest.User.Login
|
||||
build.Avatar = *hook.PullRequest.User.AvatarURL
|
||||
build.Remote = *hook.PullRequest.Base.Repo.CloneURL
|
||||
build.Title = *hook.PullRequest.Title
|
||||
// build.Timestamp = time.Now().UTC().Format("2006-01-02 15:04:05.000000000 +0000 MST")
|
||||
|
|
47
remote/github/github_test.go
Normal file
47
remote/github/github_test.go
Normal file
|
@ -0,0 +1,47 @@
|
|||
package github
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"testing"
|
||||
|
||||
"github.com/franela/goblin"
|
||||
)
|
||||
|
||||
func TestHook(t *testing.T) {
|
||||
var (
|
||||
github Github
|
||||
r *http.Request
|
||||
body *bytes.Buffer
|
||||
)
|
||||
|
||||
g := goblin.Goblin(t)
|
||||
|
||||
g.Describe("Hook", func() {
|
||||
g.BeforeEach(func() {
|
||||
github = Github{}
|
||||
body = bytes.NewBuffer([]byte{})
|
||||
r, _ = http.NewRequest("POST", "https://drone.com/hook", body)
|
||||
})
|
||||
|
||||
g.Describe("For a Pull Request", func() {
|
||||
g.BeforeEach(func() {
|
||||
r.Header.Set("X-Github-Event", "pull_request")
|
||||
})
|
||||
|
||||
g.It("Should set build author to the pull request author", func() {
|
||||
hookJson, err := ioutil.ReadFile("fixtures/pull_request.json")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
body.Write(hookJson)
|
||||
|
||||
_, build, err := github.Hook(r)
|
||||
g.Assert(err).Equal(nil)
|
||||
g.Assert(build.Author).Equal("author")
|
||||
g.Assert(build.Avatar).Equal("https://avatars.githubusercontent.com/u/55555?v=3")
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
Loading…
Reference in a new issue