Skip to content

Commit

Permalink
Merge 22710ed into 97d71e3
Browse files Browse the repository at this point in the history
  • Loading branch information
0xethsign authored Apr 21, 2021
2 parents 97d71e3 + 22710ed commit e3fadec
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 0 deletions.
56 changes: 56 additions & 0 deletions .github/workflows/commentPR.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Comment on the pull request

# read-write repo token
# access to secrets
on:
workflow_run:
workflows: ["Benchmarks"]
types:
- completed

jobs:
upload:
runs-on: ubuntu-latest
if: >
${{ github.event.workflow_run.event == 'pull_request' &&
github.event.workflow_run.conclusion == 'success' }}
steps:
- name: 'Download artifact'
uses: actions/github-script@v3.1.0
with:
script: |
var artifacts = await github.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: ${{github.event.workflow_run.id }},
});
var matchArtifact = artifacts.data.artifacts.filter((artifact) => {
return artifact.name == "pr"
})[0];
var download = await github.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
archive_format: 'zip',
});
var fs = require('fs');
fs.writeFileSync('${{github.workspace}}/pr.zip', Buffer.from(download.data));
- run: unzip pr.zip

- name: 'Comment on PR'
uses: actions/github-script@v3
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
var file = "benchResults.txt"
if (file) {
var fs = require('fs');
var issue_number = Number(fs.readFileSync('./NR'));
await github.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue_number,
body: (fs.readFileSync('./benchResults.txt')).toString('utf8')
});
}
10 changes: 10 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,14 @@ jobs:
with:
cwd: benches
token: ${{ secrets.GITHUB_TOKEN }}


- name: Save PR number
run: |
mkdir -p ./pr
echo ${{ github.event.number }} > ./pr/NR
- uses: actions/upload-artifact@v2
with:
name: pr
path: pr/

0 comments on commit e3fadec

Please sign in to comment.