Skip to content

Commit

Permalink
Added GitHub API logic to store report data
Browse files Browse the repository at this point in the history
  • Loading branch information
Coersi99 committed Nov 4, 2023
1 parent 8c40872 commit 399a0e4
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/features/reports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ const NATIVE_IMAGE_CONFIG_FILE = join(
'native-image-options.properties'
)
const NATIVE_IMAGE_CONFIG_FILE_ENV = 'NATIVE_IMAGE_CONFIG_FILE'
const github = require('@actions/github');
const core = require('@actions/core');
const { Base64 } = require("js-base64");

interface AnalysisResult {
total: number
Expand Down Expand Up @@ -125,6 +128,29 @@ export async function generateReports(): Promise<void> {
const buildOutput: BuildOutput = JSON.parse(
fs.readFileSync(BUILD_OUTPUT_JSON_PATH, 'utf8')
)

const myToken = core.getInput('myToken')
const octokit = github.getOctokit(myToken)
const contentEncoded = Base64.encode(buildOutput)

const { data } = await octokit.repos.createOrUpdateFileContents({
owner: 'jessiscript',
repo: 're23_build_tracking',
path: 'OUTPUT.json',
content: contentEncoded,
message: 'Add Report JSON data',
committer: {
name: 'Chris Fleger',
email: '[email protected]',
},
author:{
name: 'Chris Fleger',
email: '[email protected]',
}
});

console.log(data);

const report = createReport(buildOutput)
if (areJobReportsEnabled()) {
core.summary.addRaw(report)
Expand Down

0 comments on commit 399a0e4

Please sign in to comment.