non-working pullRequest createComment

This commit is contained in:
tbushman
2018-11-01 00:55:56 -06:00
committed by mrugesh mohapatra
parent d941e5c7ff
commit 14471dc4fd
4 changed files with 5541 additions and 9 deletions

View File

@ -27,16 +27,81 @@ function getPullRequest(context) {
module.exports = probotPlugin;
*/
function getPullRequest(context) {
return context.payload.pull_request || context.payload.review.pull_request;
}
module.exports = async app => {
// Your code here
app.log('Yay, the app was loaded!')
app.on('pull_request.labeled', async context => {
//const [requestedAction, prNumber] = context.payload.requested_action.identifier.split(':')
return context.payload.pullRequest.createComment({body:'probot label test'})
//const prNumber = context.payload.pull_request.number;
const { title, head, number, id } = getPullRequest(context);
const owner = context.repo().owner;
const repo = context.repo().repo;
/*const reviews =
(await context.github.pullRequests.getReviews({ owner, repo, number }))
.data || [];
const uniqueReviews = reviews
.filter(review => review.commit_id === sha)
.reduce((reviewObj, review) => {
if (
reviewObj[review.user.id] === null ||
reviewObj[review.user.id] === undefined
) {
reviewObj[review.user.id] = {
state: review.state,
submitted_at: review.submitted_at
};
} else {
const a = new Date(
reviewObj[review.user.id]["submitted_at"]
).getTime();
const b = new Date(review.submitted_at).getTime();
if (a < b) {
reviewObj[review.user.id] = {
state: review.state,
submitted_at: review.submitted_at
};
}
}
return reviewObj;
}, {});
return Object.values(uniqueReviews);
}*/
//const params =
const commit_id = head.sha;
const body = 'probot comment test';
const filepath = './app.js'
const pos = 4;
const event = 'COMMENT'
const comments = {
path: './app.js',
position: 4,
body: 'probot test'
}
const path =
//comments[].path =
filepath;
const position =
//comments[].path =
pos;
const reviewers = ['tbushman']
/*return await context.github.pullRequests.createReview({
owner,
repo,
number,
commit_id,
body,
event,
comments
})
/*const issueComment = context.issue({ body: 'probot label test' })
return context.github.issues.createComment(issueComment)*/
return await context.github.pullRequests.createReviewRequest({owner, repo, number, reviewers})
})
// For more information on building apps:
@ -45,3 +110,4 @@ module.exports = async app => {
// To get your app running against GitHub, see:
// https://probot.github.io/docs/development/
}

View File

@ -0,0 +1,469 @@
{
"action": "labeled",
"number": 13,
"pull_request": {
"url": "https://api.github.com/repos/tbushman/pu/pulls/13",
"id": 227499746,
"node_id": "MDExOlB1bGxSZXF1ZXN0MjI3NDk5NzQ2",
"html_url": "https://github.com/tbushman/pu/pull/13",
"diff_url": "https://github.com/tbushman/pu/pull/13.diff",
"patch_url": "https://github.com/tbushman/pu/pull/13.patch",
"issue_url": "https://api.github.com/repos/tbushman/pu/issues/13",
"number": 13,
"state": "open",
"locked": false,
"title": "remove comments",
"user": {
"login": "tbushman",
"id": 7049294,
"node_id": "MDQ6VXNlcjcwNDkyOTQ=",
"avatar_url": "https://avatars2.githubusercontent.com/u/7049294?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/tbushman",
"html_url": "https://github.com/tbushman",
"followers_url": "https://api.github.com/users/tbushman/followers",
"following_url": "https://api.github.com/users/tbushman/following{/other_user}",
"gists_url": "https://api.github.com/users/tbushman/gists{/gist_id}",
"starred_url": "https://api.github.com/users/tbushman/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/tbushman/subscriptions",
"organizations_url": "https://api.github.com/users/tbushman/orgs",
"repos_url": "https://api.github.com/users/tbushman/repos",
"events_url": "https://api.github.com/users/tbushman/events{/privacy}",
"received_events_url": "https://api.github.com/users/tbushman/received_events",
"type": "User",
"site_admin": false
},
"body": "",
"created_at": "2018-11-01T03:06:36Z",
"updated_at": "2018-11-01T03:24:19Z",
"closed_at": null,
"merged_at": null,
"merge_commit_sha": "fc696e1a288b07f66318e775fdd9ea619122d09e",
"assignee": null,
"assignees": [
],
"requested_reviewers": [
],
"requested_teams": [
],
"labels": [
{
"id": 511502933,
"node_id": "MDU6TGFiZWw1MTE1MDI5MzM=",
"url": "https://api.github.com/repos/tbushman/pu/labels/enhancement",
"name": "enhancement",
"color": "84b6eb",
"default": true
}
],
"milestone": null,
"commits_url": "https://api.github.com/repos/tbushman/pu/pulls/13/commits",
"review_comments_url": "https://api.github.com/repos/tbushman/pu/pulls/13/comments",
"review_comment_url": "https://api.github.com/repos/tbushman/pu/pulls/comments{/number}",
"comments_url": "https://api.github.com/repos/tbushman/pu/issues/13/comments",
"statuses_url": "https://api.github.com/repos/tbushman/pu/statuses/bce20f1db1348bdc53ac339ff91007afe88518ea",
"head": {
"label": "tbushman:presolvertest",
"ref": "presolvertest",
"sha": "bce20f1db1348bdc53ac339ff91007afe88518ea",
"user": {
"login": "tbushman",
"id": 7049294,
"node_id": "MDQ6VXNlcjcwNDkyOTQ=",
"avatar_url": "https://avatars2.githubusercontent.com/u/7049294?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/tbushman",
"html_url": "https://github.com/tbushman",
"followers_url": "https://api.github.com/users/tbushman/followers",
"following_url": "https://api.github.com/users/tbushman/following{/other_user}",
"gists_url": "https://api.github.com/users/tbushman/gists{/gist_id}",
"starred_url": "https://api.github.com/users/tbushman/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/tbushman/subscriptions",
"organizations_url": "https://api.github.com/users/tbushman/orgs",
"repos_url": "https://api.github.com/users/tbushman/repos",
"events_url": "https://api.github.com/users/tbushman/events{/privacy}",
"received_events_url": "https://api.github.com/users/tbushman/received_events",
"type": "User",
"site_admin": false
},
"repo": {
"id": 77999410,
"node_id": "MDEwOlJlcG9zaXRvcnk3Nzk5OTQxMA==",
"name": "pu",
"full_name": "tbushman/pu",
"private": false,
"owner": {
"login": "tbushman",
"id": 7049294,
"node_id": "MDQ6VXNlcjcwNDkyOTQ=",
"avatar_url": "https://avatars2.githubusercontent.com/u/7049294?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/tbushman",
"html_url": "https://github.com/tbushman",
"followers_url": "https://api.github.com/users/tbushman/followers",
"following_url": "https://api.github.com/users/tbushman/following{/other_user}",
"gists_url": "https://api.github.com/users/tbushman/gists{/gist_id}",
"starred_url": "https://api.github.com/users/tbushman/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/tbushman/subscriptions",
"organizations_url": "https://api.github.com/users/tbushman/orgs",
"repos_url": "https://api.github.com/users/tbushman/repos",
"events_url": "https://api.github.com/users/tbushman/events{/privacy}",
"received_events_url": "https://api.github.com/users/tbushman/received_events",
"type": "User",
"site_admin": false
},
"html_url": "https://github.com/tbushman/pu",
"description": "Build a map-linked timeline. Currently CV / Portfolio-style. ",
"fork": false,
"url": "https://api.github.com/repos/tbushman/pu",
"forks_url": "https://api.github.com/repos/tbushman/pu/forks",
"keys_url": "https://api.github.com/repos/tbushman/pu/keys{/key_id}",
"collaborators_url": "https://api.github.com/repos/tbushman/pu/collaborators{/collaborator}",
"teams_url": "https://api.github.com/repos/tbushman/pu/teams",
"hooks_url": "https://api.github.com/repos/tbushman/pu/hooks",
"issue_events_url": "https://api.github.com/repos/tbushman/pu/issues/events{/number}",
"events_url": "https://api.github.com/repos/tbushman/pu/events",
"assignees_url": "https://api.github.com/repos/tbushman/pu/assignees{/user}",
"branches_url": "https://api.github.com/repos/tbushman/pu/branches{/branch}",
"tags_url": "https://api.github.com/repos/tbushman/pu/tags",
"blobs_url": "https://api.github.com/repos/tbushman/pu/git/blobs{/sha}",
"git_tags_url": "https://api.github.com/repos/tbushman/pu/git/tags{/sha}",
"git_refs_url": "https://api.github.com/repos/tbushman/pu/git/refs{/sha}",
"trees_url": "https://api.github.com/repos/tbushman/pu/git/trees{/sha}",
"statuses_url": "https://api.github.com/repos/tbushman/pu/statuses/{sha}",
"languages_url": "https://api.github.com/repos/tbushman/pu/languages",
"stargazers_url": "https://api.github.com/repos/tbushman/pu/stargazers",
"contributors_url": "https://api.github.com/repos/tbushman/pu/contributors",
"subscribers_url": "https://api.github.com/repos/tbushman/pu/subscribers",
"subscription_url": "https://api.github.com/repos/tbushman/pu/subscription",
"commits_url": "https://api.github.com/repos/tbushman/pu/commits{/sha}",
"git_commits_url": "https://api.github.com/repos/tbushman/pu/git/commits{/sha}",
"comments_url": "https://api.github.com/repos/tbushman/pu/comments{/number}",
"issue_comment_url": "https://api.github.com/repos/tbushman/pu/issues/comments{/number}",
"contents_url": "https://api.github.com/repos/tbushman/pu/contents/{+path}",
"compare_url": "https://api.github.com/repos/tbushman/pu/compare/{base}...{head}",
"merges_url": "https://api.github.com/repos/tbushman/pu/merges",
"archive_url": "https://api.github.com/repos/tbushman/pu/{archive_format}{/ref}",
"downloads_url": "https://api.github.com/repos/tbushman/pu/downloads",
"issues_url": "https://api.github.com/repos/tbushman/pu/issues{/number}",
"pulls_url": "https://api.github.com/repos/tbushman/pu/pulls{/number}",
"milestones_url": "https://api.github.com/repos/tbushman/pu/milestones{/number}",
"notifications_url": "https://api.github.com/repos/tbushman/pu/notifications{?since,all,participating}",
"labels_url": "https://api.github.com/repos/tbushman/pu/labels{/name}",
"releases_url": "https://api.github.com/repos/tbushman/pu/releases{/id}",
"deployments_url": "https://api.github.com/repos/tbushman/pu/deployments",
"created_at": "2017-01-04T09:05:47Z",
"updated_at": "2018-07-01T04:09:57Z",
"pushed_at": "2018-11-01T03:06:36Z",
"git_url": "git://github.com/tbushman/pu.git",
"ssh_url": "git@github.com:tbushman/pu.git",
"clone_url": "https://github.com/tbushman/pu.git",
"svn_url": "https://github.com/tbushman/pu",
"homepage": "https://pu.bli.sh",
"size": 2720,
"stargazers_count": 0,
"watchers_count": 0,
"language": "CSS",
"has_issues": true,
"has_projects": true,
"has_downloads": true,
"has_wiki": true,
"has_pages": false,
"forks_count": 0,
"mirror_url": null,
"archived": false,
"open_issues_count": 1,
"license": null,
"forks": 0,
"open_issues": 1,
"watchers": 0,
"default_branch": "master"
}
},
"base": {
"label": "tbushman:master",
"ref": "master",
"sha": "0a92c66df823675e2a1a9a74132f2427d5bdd224",
"user": {
"login": "tbushman",
"id": 7049294,
"node_id": "MDQ6VXNlcjcwNDkyOTQ=",
"avatar_url": "https://avatars2.githubusercontent.com/u/7049294?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/tbushman",
"html_url": "https://github.com/tbushman",
"followers_url": "https://api.github.com/users/tbushman/followers",
"following_url": "https://api.github.com/users/tbushman/following{/other_user}",
"gists_url": "https://api.github.com/users/tbushman/gists{/gist_id}",
"starred_url": "https://api.github.com/users/tbushman/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/tbushman/subscriptions",
"organizations_url": "https://api.github.com/users/tbushman/orgs",
"repos_url": "https://api.github.com/users/tbushman/repos",
"events_url": "https://api.github.com/users/tbushman/events{/privacy}",
"received_events_url": "https://api.github.com/users/tbushman/received_events",
"type": "User",
"site_admin": false
},
"repo": {
"id": 77999410,
"node_id": "MDEwOlJlcG9zaXRvcnk3Nzk5OTQxMA==",
"name": "pu",
"full_name": "tbushman/pu",
"private": false,
"owner": {
"login": "tbushman",
"id": 7049294,
"node_id": "MDQ6VXNlcjcwNDkyOTQ=",
"avatar_url": "https://avatars2.githubusercontent.com/u/7049294?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/tbushman",
"html_url": "https://github.com/tbushman",
"followers_url": "https://api.github.com/users/tbushman/followers",
"following_url": "https://api.github.com/users/tbushman/following{/other_user}",
"gists_url": "https://api.github.com/users/tbushman/gists{/gist_id}",
"starred_url": "https://api.github.com/users/tbushman/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/tbushman/subscriptions",
"organizations_url": "https://api.github.com/users/tbushman/orgs",
"repos_url": "https://api.github.com/users/tbushman/repos",
"events_url": "https://api.github.com/users/tbushman/events{/privacy}",
"received_events_url": "https://api.github.com/users/tbushman/received_events",
"type": "User",
"site_admin": false
},
"html_url": "https://github.com/tbushman/pu",
"description": "Build a map-linked timeline. Currently CV / Portfolio-style. ",
"fork": false,
"url": "https://api.github.com/repos/tbushman/pu",
"forks_url": "https://api.github.com/repos/tbushman/pu/forks",
"keys_url": "https://api.github.com/repos/tbushman/pu/keys{/key_id}",
"collaborators_url": "https://api.github.com/repos/tbushman/pu/collaborators{/collaborator}",
"teams_url": "https://api.github.com/repos/tbushman/pu/teams",
"hooks_url": "https://api.github.com/repos/tbushman/pu/hooks",
"issue_events_url": "https://api.github.com/repos/tbushman/pu/issues/events{/number}",
"events_url": "https://api.github.com/repos/tbushman/pu/events",
"assignees_url": "https://api.github.com/repos/tbushman/pu/assignees{/user}",
"branches_url": "https://api.github.com/repos/tbushman/pu/branches{/branch}",
"tags_url": "https://api.github.com/repos/tbushman/pu/tags",
"blobs_url": "https://api.github.com/repos/tbushman/pu/git/blobs{/sha}",
"git_tags_url": "https://api.github.com/repos/tbushman/pu/git/tags{/sha}",
"git_refs_url": "https://api.github.com/repos/tbushman/pu/git/refs{/sha}",
"trees_url": "https://api.github.com/repos/tbushman/pu/git/trees{/sha}",
"statuses_url": "https://api.github.com/repos/tbushman/pu/statuses/{sha}",
"languages_url": "https://api.github.com/repos/tbushman/pu/languages",
"stargazers_url": "https://api.github.com/repos/tbushman/pu/stargazers",
"contributors_url": "https://api.github.com/repos/tbushman/pu/contributors",
"subscribers_url": "https://api.github.com/repos/tbushman/pu/subscribers",
"subscription_url": "https://api.github.com/repos/tbushman/pu/subscription",
"commits_url": "https://api.github.com/repos/tbushman/pu/commits{/sha}",
"git_commits_url": "https://api.github.com/repos/tbushman/pu/git/commits{/sha}",
"comments_url": "https://api.github.com/repos/tbushman/pu/comments{/number}",
"issue_comment_url": "https://api.github.com/repos/tbushman/pu/issues/comments{/number}",
"contents_url": "https://api.github.com/repos/tbushman/pu/contents/{+path}",
"compare_url": "https://api.github.com/repos/tbushman/pu/compare/{base}...{head}",
"merges_url": "https://api.github.com/repos/tbushman/pu/merges",
"archive_url": "https://api.github.com/repos/tbushman/pu/{archive_format}{/ref}",
"downloads_url": "https://api.github.com/repos/tbushman/pu/downloads",
"issues_url": "https://api.github.com/repos/tbushman/pu/issues{/number}",
"pulls_url": "https://api.github.com/repos/tbushman/pu/pulls{/number}",
"milestones_url": "https://api.github.com/repos/tbushman/pu/milestones{/number}",
"notifications_url": "https://api.github.com/repos/tbushman/pu/notifications{?since,all,participating}",
"labels_url": "https://api.github.com/repos/tbushman/pu/labels{/name}",
"releases_url": "https://api.github.com/repos/tbushman/pu/releases{/id}",
"deployments_url": "https://api.github.com/repos/tbushman/pu/deployments",
"created_at": "2017-01-04T09:05:47Z",
"updated_at": "2018-07-01T04:09:57Z",
"pushed_at": "2018-11-01T03:06:36Z",
"git_url": "git://github.com/tbushman/pu.git",
"ssh_url": "git@github.com:tbushman/pu.git",
"clone_url": "https://github.com/tbushman/pu.git",
"svn_url": "https://github.com/tbushman/pu",
"homepage": "https://pu.bli.sh",
"size": 2720,
"stargazers_count": 0,
"watchers_count": 0,
"language": "CSS",
"has_issues": true,
"has_projects": true,
"has_downloads": true,
"has_wiki": true,
"has_pages": false,
"forks_count": 0,
"mirror_url": null,
"archived": false,
"open_issues_count": 1,
"license": null,
"forks": 0,
"open_issues": 1,
"watchers": 0,
"default_branch": "master"
}
},
"_links": {
"self": {
"href": "https://api.github.com/repos/tbushman/pu/pulls/13"
},
"html": {
"href": "https://github.com/tbushman/pu/pull/13"
},
"issue": {
"href": "https://api.github.com/repos/tbushman/pu/issues/13"
},
"comments": {
"href": "https://api.github.com/repos/tbushman/pu/issues/13/comments"
},
"review_comments": {
"href": "https://api.github.com/repos/tbushman/pu/pulls/13/comments"
},
"review_comment": {
"href": "https://api.github.com/repos/tbushman/pu/pulls/comments{/number}"
},
"commits": {
"href": "https://api.github.com/repos/tbushman/pu/pulls/13/commits"
},
"statuses": {
"href": "https://api.github.com/repos/tbushman/pu/statuses/bce20f1db1348bdc53ac339ff91007afe88518ea"
}
},
"author_association": "OWNER",
"merged": false,
"mergeable": true,
"rebaseable": true,
"mergeable_state": "clean",
"merged_by": null,
"comments": 0,
"review_comments": 0,
"maintainer_can_modify": false,
"commits": 1,
"additions": 0,
"deletions": 6,
"changed_files": 1
},
"label": {
"id": 511502933,
"node_id": "MDU6TGFiZWw1MTE1MDI5MzM=",
"url": "https://api.github.com/repos/tbushman/pu/labels/enhancement",
"name": "enhancement",
"color": "84b6eb",
"default": true
},
"repository": {
"id": 77999410,
"node_id": "MDEwOlJlcG9zaXRvcnk3Nzk5OTQxMA==",
"name": "pu",
"full_name": "tbushman/pu",
"private": false,
"owner": {
"login": "tbushman",
"id": 7049294,
"node_id": "MDQ6VXNlcjcwNDkyOTQ=",
"avatar_url": "https://avatars2.githubusercontent.com/u/7049294?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/tbushman",
"html_url": "https://github.com/tbushman",
"followers_url": "https://api.github.com/users/tbushman/followers",
"following_url": "https://api.github.com/users/tbushman/following{/other_user}",
"gists_url": "https://api.github.com/users/tbushman/gists{/gist_id}",
"starred_url": "https://api.github.com/users/tbushman/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/tbushman/subscriptions",
"organizations_url": "https://api.github.com/users/tbushman/orgs",
"repos_url": "https://api.github.com/users/tbushman/repos",
"events_url": "https://api.github.com/users/tbushman/events{/privacy}",
"received_events_url": "https://api.github.com/users/tbushman/received_events",
"type": "User",
"site_admin": false
},
"html_url": "https://github.com/tbushman/pu",
"description": "Build a map-linked timeline. Currently CV / Portfolio-style. ",
"fork": false,
"url": "https://api.github.com/repos/tbushman/pu",
"forks_url": "https://api.github.com/repos/tbushman/pu/forks",
"keys_url": "https://api.github.com/repos/tbushman/pu/keys{/key_id}",
"collaborators_url": "https://api.github.com/repos/tbushman/pu/collaborators{/collaborator}",
"teams_url": "https://api.github.com/repos/tbushman/pu/teams",
"hooks_url": "https://api.github.com/repos/tbushman/pu/hooks",
"issue_events_url": "https://api.github.com/repos/tbushman/pu/issues/events{/number}",
"events_url": "https://api.github.com/repos/tbushman/pu/events",
"assignees_url": "https://api.github.com/repos/tbushman/pu/assignees{/user}",
"branches_url": "https://api.github.com/repos/tbushman/pu/branches{/branch}",
"tags_url": "https://api.github.com/repos/tbushman/pu/tags",
"blobs_url": "https://api.github.com/repos/tbushman/pu/git/blobs{/sha}",
"git_tags_url": "https://api.github.com/repos/tbushman/pu/git/tags{/sha}",
"git_refs_url": "https://api.github.com/repos/tbushman/pu/git/refs{/sha}",
"trees_url": "https://api.github.com/repos/tbushman/pu/git/trees{/sha}",
"statuses_url": "https://api.github.com/repos/tbushman/pu/statuses/{sha}",
"languages_url": "https://api.github.com/repos/tbushman/pu/languages",
"stargazers_url": "https://api.github.com/repos/tbushman/pu/stargazers",
"contributors_url": "https://api.github.com/repos/tbushman/pu/contributors",
"subscribers_url": "https://api.github.com/repos/tbushman/pu/subscribers",
"subscription_url": "https://api.github.com/repos/tbushman/pu/subscription",
"commits_url": "https://api.github.com/repos/tbushman/pu/commits{/sha}",
"git_commits_url": "https://api.github.com/repos/tbushman/pu/git/commits{/sha}",
"comments_url": "https://api.github.com/repos/tbushman/pu/comments{/number}",
"issue_comment_url": "https://api.github.com/repos/tbushman/pu/issues/comments{/number}",
"contents_url": "https://api.github.com/repos/tbushman/pu/contents/{+path}",
"compare_url": "https://api.github.com/repos/tbushman/pu/compare/{base}...{head}",
"merges_url": "https://api.github.com/repos/tbushman/pu/merges",
"archive_url": "https://api.github.com/repos/tbushman/pu/{archive_format}{/ref}",
"downloads_url": "https://api.github.com/repos/tbushman/pu/downloads",
"issues_url": "https://api.github.com/repos/tbushman/pu/issues{/number}",
"pulls_url": "https://api.github.com/repos/tbushman/pu/pulls{/number}",
"milestones_url": "https://api.github.com/repos/tbushman/pu/milestones{/number}",
"notifications_url": "https://api.github.com/repos/tbushman/pu/notifications{?since,all,participating}",
"labels_url": "https://api.github.com/repos/tbushman/pu/labels{/name}",
"releases_url": "https://api.github.com/repos/tbushman/pu/releases{/id}",
"deployments_url": "https://api.github.com/repos/tbushman/pu/deployments",
"created_at": "2017-01-04T09:05:47Z",
"updated_at": "2018-07-01T04:09:57Z",
"pushed_at": "2018-11-01T03:06:36Z",
"git_url": "git://github.com/tbushman/pu.git",
"ssh_url": "git@github.com:tbushman/pu.git",
"clone_url": "https://github.com/tbushman/pu.git",
"svn_url": "https://github.com/tbushman/pu",
"homepage": "https://pu.bli.sh",
"size": 2720,
"stargazers_count": 0,
"watchers_count": 0,
"language": "CSS",
"has_issues": true,
"has_projects": true,
"has_downloads": true,
"has_wiki": true,
"has_pages": false,
"forks_count": 0,
"mirror_url": null,
"archived": false,
"open_issues_count": 1,
"license": null,
"forks": 0,
"open_issues": 1,
"watchers": 0,
"default_branch": "master"
},
"sender": {
"login": "tbushman",
"id": 7049294,
"node_id": "MDQ6VXNlcjcwNDkyOTQ=",
"avatar_url": "https://avatars2.githubusercontent.com/u/7049294?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/tbushman",
"html_url": "https://github.com/tbushman",
"followers_url": "https://api.github.com/users/tbushman/followers",
"following_url": "https://api.github.com/users/tbushman/following{/other_user}",
"gists_url": "https://api.github.com/users/tbushman/gists{/gist_id}",
"starred_url": "https://api.github.com/users/tbushman/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/tbushman/subscriptions",
"organizations_url": "https://api.github.com/users/tbushman/orgs",
"repos_url": "https://api.github.com/users/tbushman/repos",
"events_url": "https://api.github.com/users/tbushman/events{/privacy}",
"received_events_url": "https://api.github.com/users/tbushman/received_events",
"type": "User",
"site_admin": false
},
"installation": {
"id": 421598,
"node_id": "MDIzOkludGVncmF0aW9uSW5zdGFsbGF0aW9uNDIxNTk4"
}
}

View File

@ -3,7 +3,7 @@ const nock = require('nock')
const myProbotApp = require('..')
const { Probot } = require('probot')
// Requiring our fixtures
const payload = require('./fixtures/issues.opened')
const payload = require('./fixtures/pullRequests.labeled')
const issueCreatedBody = { body: 'Thanks for opening this issue!' }
nock.disableNetConnect()
@ -21,21 +21,20 @@ describe('My Probot app', () => {
})
test('creates a comment when an issue is opened', async () => {
// Test that we correctly return a test token
nock('https://api.github.com')
.post('/app/installations/2/access_tokens')
.post('/app/installations/421598/access_tokens')
.reply(200, { token: 'test' })
// Test that a comment is posted
nock('https://api.github.com')
/*nock('https://api.github.com')
.post('/repos/hiimbex/testing-things/issues/1/comments', (body) => {
expect(body).toMatchObject(issueCreatedBody)
return true
})
.reply(200)
.reply(200)*/
// Receive a webhook event
await probot.receive({ name: 'issues', payload })
await probot.receive({name: 'pull_request', payload: payload})
})
})

4998
probot/presolver/yarn.lock Normal file

File diff suppressed because it is too large Load Diff