Skip to content

Commit 399a0e4

Browse files
committed
Added GitHub API logic to store report data
1 parent 8c40872 commit 399a0e4

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

src/features/reports.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ const NATIVE_IMAGE_CONFIG_FILE = join(
2020
'native-image-options.properties'
2121
)
2222
const NATIVE_IMAGE_CONFIG_FILE_ENV = 'NATIVE_IMAGE_CONFIG_FILE'
23+
const github = require('@actions/github');
24+
const core = require('@actions/core');
25+
const { Base64 } = require("js-base64");
2326

2427
interface AnalysisResult {
2528
total: number
@@ -125,6 +128,29 @@ export async function generateReports(): Promise<void> {
125128
const buildOutput: BuildOutput = JSON.parse(
126129
fs.readFileSync(BUILD_OUTPUT_JSON_PATH, 'utf8')
127130
)
131+
132+
const myToken = core.getInput('myToken')
133+
const octokit = github.getOctokit(myToken)
134+
const contentEncoded = Base64.encode(buildOutput)
135+
136+
const { data } = await octokit.repos.createOrUpdateFileContents({
137+
owner: 'jessiscript',
138+
repo: 're23_build_tracking',
139+
path: 'OUTPUT.json',
140+
content: contentEncoded,
141+
message: 'Add Report JSON data',
142+
committer: {
143+
name: 'Chris Fleger',
144+
145+
},
146+
author:{
147+
name: 'Chris Fleger',
148+
149+
}
150+
});
151+
152+
console.log(data);
153+
128154
const report = createReport(buildOutput)
129155
if (areJobReportsEnabled()) {
130156
core.summary.addRaw(report)

0 commit comments

Comments
 (0)