Skip to content

Commit 3a82185

Browse files
committed
pass compiation outputs
1 parent 6b2f9ad commit 3a82185

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

.github/workflows/test.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,20 @@ on:
1111
jobs:
1212
compile:
1313
runs-on: ubuntu-latest
14+
outputs:
15+
compilation_outputs: ${{ steps.compile.outputs }}
1416
steps:
1517
- uses: actions/checkout@v4
16-
- run: g++ -Wall -Wextra -o test source.cpp
18+
- run: g++ -Wall -Wextra -o test source.cpp 2 > $GITHUB_OUTPUT
19+
id: compile
1720
- run: ./test
1821

1922
test:
2023
needs:
2124
- compile
2225
runs-on: ubuntu-latest
26+
outputs:
27+
compilation_outputs: ${{ needs.compile.outputs.compilation_outputs }}
2328
steps:
2429
- uses: actions/checkout@v4
2530
- uses: actions/setup-node@v4
@@ -30,3 +35,4 @@ jobs:
3035
- run: node dist/index.js
3136
env:
3237
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
38+
COMPILATION_OUTPUTS: ${{ needs.compile.outputs.compilation_outputs }}

src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ const octokit = new Octokit();
44

55
const [owner, repo] = process.env.GITHUB_REPOSITORY?.split("/")!;
66
const pull_request_number = parseInt(process.env.GITHUB_REF?.split("/")[2]!);
7+
const compilation_output = process.env.COMPILATION_OUTPUT!;
78

89
const { data: pullRequest } = await octokit.rest.pulls.get({
910
owner,
@@ -35,6 +36,6 @@ if (workflow_runs.length === 0) {
3536
owner,
3637
repo,
3738
issue_number: pull_request_number,
38-
body: `The latest workflow run for this pull request is [#${latest.run_number}](${latest.html_url})`,
39+
body: `The latest workflow run for this pull request is [#${latest.run_number}](${latest.html_url}), and the compilation output is:\n\n\`\`\`\n${compilation_output}\n\`\`\``,
3940
});
4041
}

0 commit comments

Comments
 (0)