-
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathcomment.js
More file actions
21 lines (18 loc) · 684 Bytes
/
comment.js
File metadata and controls
21 lines (18 loc) · 684 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
const github = require('@actions/github');
const core = require('@actions/core');
function getBody(warnings, errors) {
return `Compilation Warnings:\n${warnings.join('\n')}\n\nCompilation Errors:\n${errors.join('\n')}\n`;
}
module.exports = async (warnings, errors) => {
const payload = github.context.payload;
if (github.context.eventName !== 'pull_request') {
return;
}
const octokit = github.getOctokit(core.getInput('github-token'));
await octokit.issues.createComment({
owner: payload.repository.owner.login,
repo: payload.repository.name,
issue_number: payload.number, // eslint-disable-line camelcase
body: getBody(warnings, errors)
});
};