Skip to content

Commit 60d1bd0

Browse files
committed
Remove some abstractions to stop deprecation warnings and fix a thing
1 parent 1d414fc commit 60d1bd0

File tree

1 file changed

+14
-17
lines changed

1 file changed

+14
-17
lines changed

index.js

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Not sure what this means? [Click here to learn what changesets are](https://git
3030
`;
3131

3232
const getCommentId = (context, params) =>
33-
context.github.pullRequests.listComments(params).then(comments => {
33+
context.github.issues.listComments(params).then(comments => {
3434
const changesetBotComment = comments.data.find(
3535
// TODO: find what the current user is in some way or something
3636
comment =>
@@ -67,8 +67,9 @@ module.exports = app => {
6767
try {
6868
const params = context.issue();
6969

70-
let queryStuff = {
71-
pull_number: context.payload.number,
70+
let number = context.payload.number;
71+
72+
let repo = {
7273
repo: context.payload.repository.name,
7374
owner: context.payload.repository.owner.login
7475
};
@@ -90,23 +91,19 @@ module.exports = app => {
9091
// but reducing time is nice here so that
9192
// deploying this doesn't cost money
9293
context.payload.action === "synchronize"
93-
? getCommentId(context, queryStuff)
94+
? getCommentId(context, { ...repo, issue_number: number })
9495
: null,
95-
getChangesetId(context, queryStuff)
96+
getChangesetId(context, { ...repo, pull_number: number })
9697
]);
9798

98-
let prComment;
99-
if (!hasChangeset) {
100-
prComment = context.issue({
101-
comment_id: commentId,
102-
body: getAbsentMessage(latestCommitSha, addChangesetUrl)
103-
});
104-
} else {
105-
prComment = context.issue({
106-
comment_id: commentId,
107-
body: getApproveMessage(latestCommitSha, addChangesetUrl)
108-
});
109-
}
99+
let prComment = {
100+
...repo,
101+
comment_id: commentId,
102+
issue_number: number,
103+
body: hasChangeset
104+
? getApproveMessage(latestCommitSha, addChangesetUrl)
105+
: getAbsentMessage(latestCommitSha, addChangesetUrl)
106+
};
110107

111108
if (commentId) {
112109
return context.github.issues.updateComment(prComment);

0 commit comments

Comments
 (0)