forked from graalvm/setup-graalvm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added GitHub API logic to store report data
- Loading branch information
Showing
1 changed file
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|
@@ -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) | ||
|