Skip to content

Commit 4c44e85

Browse files
committed
test: verify convert-to-draft and back again
TOKEN=GITHUB_ACCESS_TOKEN npx lerna exec --scope=wuffle node test.js
1 parent 676e2fa commit 4c44e85

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

packages/app/test.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
const gql = require('fake-tag');
2+
3+
const { graphql } = require('@octokit/graphql');
4+
5+
const authenticatedGraphql = graphql.defaults({
6+
headers: {
7+
authorization: `token ${process.env.TOKEN}`
8+
}
9+
});
10+
11+
const convertToDraftQuery = gql`
12+
mutation ConvertToDraft($pull_id: ID!) {
13+
convertPullRequestToDraft(input: { pullRequestId: $pull_id }) {
14+
pullRequest {
15+
updatedAt
16+
}
17+
}
18+
}
19+
`;
20+
21+
const markReadyForReviewQuery = gql`
22+
mutation MarkReadyForReview($pull_id: ID!) {
23+
markPullRequestReadyForReview(input: { pullRequestId: $pull_id }) {
24+
pullRequest {
25+
updatedAt
26+
}
27+
}
28+
}
29+
`;
30+
31+
authenticatedGraphql(markReadyForReviewQuery, {"pull_id": "MDExOlB1bGxSZXF1ZXN0MzI3NTkzNTc2" }).then(result => {
32+
console.log(result);
33+
}).catch(err => {
34+
console.error(err);
35+
});

0 commit comments

Comments
 (0)