Skip to content

Commit

Permalink
fixed impl, fetching the pr again and check if it is a draft there
Browse files Browse the repository at this point in the history
  • Loading branch information
steffektif authored and steffektif committed May 20, 2020
1 parent 7af6eea commit 47a0f3a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 15 deletions.
15 changes: 9 additions & 6 deletions lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,19 @@ function run() {
const repo = github_1.context.repo.repo;
const pr_number = Number((_a = github_1.context.payload.pull_request) === null || _a === void 0 ? void 0 : _a.number);
const prId = (_b = github_1.context.payload.pull_request) === null || _b === void 0 ? void 0 : _b.id;
const promise = octokit.pulls.get({
octokit.pulls.get({
owner: owner,
repo: repo,
pull_number: pr_number,
});
promise.then((result) => {
console.log(result.data.draft);
}, error => {
console.log(error);
});
// promise.then(
// (result) => {
// console.log(result.data.draft)
// },
// error => {
// console.log(error)
// }
// )
// const isDraft = result.data.draft
// if(ignoreDrafts){
// if(!isDraft) {
Expand Down
18 changes: 9 additions & 9 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,20 @@ async function run(): Promise<void> {
const pr_number = Number(context.payload.pull_request?.number)
const prId = context.payload.pull_request?.id

const promise = octokit.pulls.get({
octokit.pulls.get({
owner: owner,
repo: repo,
pull_number: pr_number,
})

promise.then(
(result) => {
console.log(result.data.draft)
},
error => {
console.log(error)
}
)
// promise.then(
// (result) => {
// console.log(result.data.draft)
// },
// error => {
// console.log(error)
// }
// )

// const isDraft = result.data.draft
// if(ignoreDrafts){
Expand Down

0 comments on commit 47a0f3a

Please sign in to comment.