Skip to content

Commit

Permalink
fix: adapt for latest @octokit/rest to remove deprecation warnings (#177
Browse files Browse the repository at this point in the history
)
  • Loading branch information
immanuel192 authored and gr2m committed Apr 25, 2019
1 parent d2d873c commit fa677fa
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
3 changes: 2 additions & 1 deletion lib/fail.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ module.exports = async (pluginConfig, context) => {

if (srIssue) {
logger.log('Found existing semantic-release issue #%d.', srIssue.number);
const comment = {owner, repo, number: srIssue.number, body};
// eslint-disable-next-line camelcase
const comment = {owner, repo, issue_number: srIssue.number, body};
debug('create comment: %O', comment);
const {
data: {html_url: url},
Expand Down
15 changes: 10 additions & 5 deletions lib/success.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,10 @@ module.exports = async (pluginConfig, context) => {
const prs = await pFilter(
uniqBy(flatten(await Promise.all(searchQueries)), 'number'),
async ({number}) =>
(await github.pullRequests.listCommits({owner, repo, number})).data.find(({sha}) => shas.includes(sha)) ||
shas.includes((await github.pullRequests.get({owner, repo, number})).data.merge_commit_sha)
// eslint-disable-next-line camelcase
(await github.pullRequests.listCommits({owner, repo, pull_number: number})).data.find(({sha}) =>
shas.includes(sha)
) || shas.includes((await github.pullRequests.get({owner, repo, pull_number: number})).data.merge_commit_sha) // eslint-disable-line camelcase
);

debug('found pull requests: %O', prs.map(pr => pr.number));
Expand All @@ -76,10 +78,12 @@ module.exports = async (pluginConfig, context) => {
? template(successComment)({branch, lastRelease, commits, nextRelease, releases, issue})
: getSuccessComment(issue, releaseInfos, nextRelease);
try {
const state = issue.state || (await github.issues.get({owner, repo, number: issue.number})).data.state;
// eslint-disable-next-line camelcase
const state = issue.state || (await github.issues.get({owner, repo, issue_number: issue.number})).data.state;

if (state === 'closed') {
const comment = {owner, repo, number: issue.number, body};
// eslint-disable-next-line camelcase
const comment = {owner, repo, issue_number: issue.number, body};
debug('create comment: %O', comment);
const {
data: {html_url: url},
Expand Down Expand Up @@ -124,7 +128,8 @@ module.exports = async (pluginConfig, context) => {
srIssues.map(async issue => {
debug('close issue: %O', issue);
try {
const updateIssue = {owner, repo, number: issue.number, state: 'closed'};
// eslint-disable-next-line camelcase
const updateIssue = {owner, repo, issue_number: issue.number, state: 'closed'};
debug('closing issue: %O', updateIssue);
const {
data: {html_url: url},
Expand Down

0 comments on commit fa677fa

Please sign in to comment.