Skip to content

Commit

Permalink
chore(test-results): add a comment to the pull request
Browse files Browse the repository at this point in the history
  • Loading branch information
thatkookooguy committed Dec 19, 2019
1 parent 0e409ca commit b91cb9d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
20 changes: 19 additions & 1 deletion deploy-test-results.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,32 @@ if (!travisPullRequest ||
}

exec(`now alias --token=${nowToken} $(now ./test-results --no-clipboard --token=${nowToken} --public) achievibit-pr-${ travisPullRequest }`,
(err, stdout, stderr) => {
async (err, stdout, stderr) => {
if (err) {
console.error(err);
// node couldn't execute the command
return;
}

const Octokit = require("@octokit/rest");
const auth = process.env.GH_TOKEN;
const octokit = new Octokit({ auth });

const prSlug = process.env.TRAVIS_PULL_REQUEST_SLUG;

const splitted = prSlug.split('\/');

const comment = {
repo: splitted[1],
owner: splitted[0],
issue_number: travisPullRequest,
body: 'very nice, sir!'
};

const response = await octokit.issues.createComment(comment);

// the *entire* stdout and stderr (buffered)
console.log(`stdout: ${stdout}`);
console.log(`stderr: ${stderr}`);
console.log(response);
});
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
"@nestjs/schematics": "^6.7.0",
"@nestjs/testing": "^6.7.1",
"@nestjs/typeorm": "^6.2.0",
"@octokit/rest": "^16.35.2",
"@types/chance": "^1.0.7",
"@types/depcheck": "^0.9.1",
"@types/dotenv": "^8.2.0",
Expand Down

0 comments on commit b91cb9d

Please sign in to comment.