Skip to content

Commit 1fc57d8

Browse files
authored
update (#3)
* update * debug * debug2 * bundle * download artifacts * specify name * remove debug print * nullable body
1 parent 110e6eb commit 1fc57d8

5 files changed

Lines changed: 25 additions & 19 deletions

File tree

.github/workflows/test.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
- uses: actions/upload-artifact@v4
2121
with:
2222
name: compilation_log
23-
path: compilation.log
23+
path: compilation*.log
2424
- run: ./build/hello_world
2525

2626
run-notifier:
@@ -31,6 +31,9 @@ jobs:
3131
name: MyEnvironment
3232
steps:
3333
- uses: actions/checkout@v4
34+
- uses: actions/download-artifact@v4
35+
with:
36+
name: compilation_log
3437
- uses: ./
3538
with:
3639
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

dist/index.js

Lines changed: 7 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/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.

source.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
#include <iostream>
22

3-
#warning "WARNNING: This is a warning message"
4-
53
[[nodiscard]] int func() { return 42; }
64

75
int main() {

src/index.ts

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,13 @@ const installationId = parseInt(process.env.INPUT_INSTALLATION_ID!);
1212
const clientId = process.env.INPUT_CLIENT_ID!;
1313
const clientSecret = process.env.INPUT_CLIENT_SECRET!;
1414

15-
console.log(appId, installationId, clientId);
16-
1715
const app = new App({ appId, privateKey, oauth: { clientId, clientSecret } });
1816
const octokit = await app.getInstallationOctokit(installationId);
1917

2018
const [owner, repo] = process.env.GITHUB_REPOSITORY?.split("/")!;
2119
const pull_request_number = parseInt(process.env.GITHUB_REF?.split("/")[2]!);
2220

23-
let body = "";
21+
let body: string | null = null;
2422

2523
for (const file of readdirSync(".")) {
2624
if (!file.startsWith("compilation") || !file.endsWith(".log")) {
@@ -34,13 +32,18 @@ for (const file of readdirSync(".")) {
3432
const match_result = compilation_output.match(regex);
3533

3634
if (match_result && match_result.length > 0) {
37-
body += `detected warnings in the compilation output: <details><summary>compilation output</summary>\n\n\`\`\`\n${compilation_output}\n\`\`\`\n</details>\n`;
35+
body =
36+
body ||
37+
body +
38+
`detected warnings in the compilation output: <details><summary>compilation output</summary>\n\n\`\`\`\n${compilation_output}\n\`\`\`\n</details>\n`;
3839
}
3940
}
4041

41-
octokit.rest.issues.createComment({
42-
owner,
43-
repo,
44-
issue_number: pull_request_number,
45-
body,
46-
});
42+
if (body !== null) {
43+
octokit.rest.issues.createComment({
44+
owner,
45+
repo,
46+
issue_number: pull_request_number,
47+
body,
48+
});
49+
}

0 commit comments

Comments
 (0)