Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- uses: actions/upload-artifact@v4
with:
name: compilation_log
path: compilation.log
path: compilation*.log
- run: ./build/hello_world

run-notifier:
Expand All @@ -31,6 +31,9 @@ jobs:
name: MyEnvironment
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: compilation_log
- uses: ./
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
12 changes: 7 additions & 5 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions source.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#include <iostream>

#warning "WARNNING: This is a warning message"

[[nodiscard]] int func() { return 42; }

int main() {
Expand Down
23 changes: 13 additions & 10 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,13 @@ const installationId = parseInt(process.env.INPUT_INSTALLATION_ID!);
const clientId = process.env.INPUT_CLIENT_ID!;
const clientSecret = process.env.INPUT_CLIENT_SECRET!;

console.log(appId, installationId, clientId);

const app = new App({ appId, privateKey, oauth: { clientId, clientSecret } });
const octokit = await app.getInstallationOctokit(installationId);

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

let body = "";
let body: string | null = null;

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

if (match_result && match_result.length > 0) {
body += `detected warnings in the compilation output: <details><summary>compilation output</summary>\n\n\`\`\`\n${compilation_output}\n\`\`\`\n</details>\n`;
body =
body ||
body +
`detected warnings in the compilation output: <details><summary>compilation output</summary>\n\n\`\`\`\n${compilation_output}\n\`\`\`\n</details>\n`;
}
}

octokit.rest.issues.createComment({
owner,
repo,
issue_number: pull_request_number,
body,
});
if (body !== null) {
octokit.rest.issues.createComment({
owner,
repo,
issue_number: pull_request_number,
body,
});
}