/.github/workflows/ci-performance-benchmarks.yaml: get results with javascript

This commit is contained in:
Dustin Brown
2021-01-05 13:38:57 -08:00
parent 42d1f65788
commit 2a53d2e5b6

View File

@@ -87,24 +87,24 @@ jobs:
run: |
echo "Get benchmark results here: $KEY"
aws s3api get-object --bucket=performance-benchmarking-github-actions-results --key="$KEY" results.log
results=$(cat results.log)
results="${results//$'\n'/'%0A'}"
echo "::set-output name=results::$results"
env:
KEY: ${{ steps.run-benchmarks.outputs.object-key }}
- name: View context attributes
- name: Post results to PR
uses: actions/github-script@v3
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
console.log("This is body:", process.env.BODY)
github.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `@${process.env.ACTOR}\n ${process.env.BODY}`
})
fs = require('fs');
fs.readFile(`${process.env.GITHUB_WORKSPACE}/results.log`, 'utf8', function (err,data) {
if (err) {
return console.log(err);
}
return github.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `@${process.env.ACTOR}\n ${data}`
});
});
env:
BODY: ${{ steps.get-results.outputs.results }}
ACTOR: ${{ github.actor }}