Skip to content

Commit 760b062

Browse files
Balaji Srinivasanzgosalvez
andauthored
Log before writing a PR comment (#24)
* Log before writing a PR comment If the github-token provided in the workflow file does not have permissions to publish comments in the PR's target repo, then the github-token will evaluate to empty string even if it was provided in the workflow file. Adding logs will explain the situation better and avoid user confusions. Signed-off-by: Balaji Srinivasan <balaji.srinivasan@nordicsemi.no> * Run prepare Co-authored-by: Zennon Gosalvez <1798166+zgosalvez@users.noreply.github.com>
1 parent bfb4913 commit 760b062

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

dist/main/index.js

Lines changed: 9 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/main/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,16 @@ async function run() {
3737
body += `\n:no_entry: ${errorMessage}`;
3838
}
3939

40+
core.debug("Creating a comment in the PR.")
4041
await octokit.issues.createComment({
4142
owner: github.context.repo.owner,
4243
repo: github.context.repo.repo,
4344
issue_number: github.context.payload.pull_request.number,
4445
body: body,
4546
});
47+
} else {
48+
core.info("github-token received is empty. Skipping writing a comment in the PR.");
49+
core.info("Note: This could happen even if github-token was provided in workflow file. It could be because your github token does not have permissions for commenting in target repo.")
4650
}
4751

4852
if (isFailure) {

0 commit comments

Comments
 (0)