forked from galaxyproject/iwc
-
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.
- Loading branch information
Showing
2 changed files
with
57 additions
and
17 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 |
---|---|---|
@@ -0,0 +1,52 @@ | ||
name: Comment on the pull request | ||
|
||
# read-write repo token | ||
# access to secrets | ||
on: | ||
workflow_run: | ||
workflows: ["Galaxy Workflow Tests for push and PR"] | ||
types: | ||
- completed | ||
|
||
jobs: | ||
upload: | ||
runs-on: ubuntu-latest | ||
if: github.event.workflow_run.event == 'pull_request' | ||
steps: | ||
- name: 'Download artifact' | ||
uses: actions/[email protected] | ||
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 == 'All tool test results' | ||
})[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}}/upload.zip', Buffer.from(download.data)); | ||
- run: unzip upload.zip | ||
- name: Check the output of unzip | ||
run: | | ||
ls | ||
- name: 'Comment on PR' | ||
uses: actions/github-script@v3 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
script: | | ||
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('./tool_test_output.md') | ||
}); |
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 |
---|---|---|
|
@@ -89,6 +89,11 @@ jobs: | |
html-report: true | ||
markdown-report: true | ||
- run: cat upload/tool_test_output.md >> $GITHUB_STEP_SUMMARY | ||
- name: Save PR number | ||
run: echo ${{ github.event.number }} > ./upload/NR | ||
- name: Debug PR number | ||
run: | | ||
cat ./upload/NR | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: 'All tool test results' | ||
|
@@ -98,23 +103,6 @@ jobs: | |
id: check | ||
with: | ||
mode: check | ||
- name: Get PR object | ||
if: failure() | ||
uses: 8BitJonny/[email protected] | ||
id: failed_pr_number | ||
with: | ||
sha: ${{ github.event.pull_request.head.sha }} | ||
- name: Debug GetPR output | ||
if: failure() | ||
run: | | ||
echo ${{ steps.failed_pr_number.outputs.number }} | ||
- name: Post comment with test report | ||
if: failure() | ||
uses: peter-evans/create-or-update-comment@v3 | ||
with: | ||
token: ${{ secrets.PAT }} | ||
issue-number: ${{ steps.failed_pr_number.outputs.number }} | ||
body-path: upload/tool_test_output.md | ||
|
||
# deploy workflows to organization | ||
deploy: | ||
|