Skip to content

Commit

Permalink
fix: more pr & author info (#119)
Browse files Browse the repository at this point in the history
  • Loading branch information
DekusDenial authored and jithine committed Jan 25, 2019
1 parent 9e3a579 commit 78720e3
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 10 deletions.
7 changes: 5 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,9 @@ class GithubScm extends Scm {
ref: `pull/${pullRequest.number}/merge`,
username: pullRequest.user.login,
title: pullRequest.title,
createTime: pullRequest.created_at
createTime: pullRequest.created_at,
url: pullRequest.html_url,
userProfile: pullRequest.user.html_url
}));
} catch (err) {
winston.error('Failed to getOpenedPRs: ', err);
Expand Down Expand Up @@ -1090,7 +1092,8 @@ class GithubScm extends Scm {
url: pullRequestInfo.data.html_url,
username: pullRequestInfo.data.user.login,
title: pullRequestInfo.data.title,
createTime: pullRequestInfo.data.created_at
createTime: pullRequestInfo.data.created_at,
userProfile: pullRequestInfo.data.user.html_url
};
} catch (err) {
winston.error('Failed to getPrInfo: ', err);
Expand Down
26 changes: 18 additions & 8 deletions test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1804,17 +1804,21 @@ jobs:
number: 1,
title: 'Test 1',
user: {
login: 'collab1'
login: 'collab1',
html_url: '/collab1'
},
created_at: '2018-10-09T21:35:31Z'
created_at: '2018-10-09T21:35:31Z',
html_url: '/pull/1'
},
{
number: 2,
title: 'Test 2',
user: {
login: 'collab2'
login: 'collab2',
html_url: '/collab2'
},
created_at: '2018-10-10T21:35:31Z'
created_at: '2018-10-10T21:35:31Z',
html_url: '/pull/2'
}]
});

Expand All @@ -1825,14 +1829,18 @@ jobs:
ref: 'pull/1/merge',
title: 'Test 1',
username: 'collab1',
createTime: '2018-10-09T21:35:31Z'
createTime: '2018-10-09T21:35:31Z',
userProfile: '/collab1',
url: '/pull/1'
},
{
name: 'PR-2',
ref: 'pull/2/merge',
title: 'Test 2',
username: 'collab2',
createTime: '2018-10-10T21:35:31Z'
createTime: '2018-10-10T21:35:31Z',
userProfile: '/collab2',
url: '/pull/2'
}
]);

Expand Down Expand Up @@ -1897,7 +1905,8 @@ jobs:
url: 'https://github.com/octocat/Hello-World/pull/1',
username: 'octocat',
title: 'new-feature',
createTime: '2011-01-26T19:01:12Z'
createTime: '2011-01-26T19:01:12Z',
userProfile: 'https://github.com/octocat'
}
);
assert.calledWith(githubMock.repos.getById, { id: '111' });
Expand Down Expand Up @@ -1930,7 +1939,8 @@ jobs:
url: 'https://github.com/octocat/Hello-World/pull/1',
username: 'octocat',
title: 'new-feature',
createTime: '2011-01-26T19:01:12Z'
createTime: '2011-01-26T19:01:12Z',
userProfile: 'https://github.com/octocat'
}
);
assert.notCalled(githubMock.repos.getById);
Expand Down

0 comments on commit 78720e3

Please sign in to comment.