Annotate checks #317
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
name: Annotate checks | |
on: | |
workflow_run: | |
workflows: ["Java CI with Maven", "Release with Maven"] | |
types: | |
- completed | |
jobs: | |
annotate: | |
if: github.repository_owner == 'nineinchnick' | |
runs-on: ubuntu-latest | |
steps: | |
- name: 'Download artifact' | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const fs = require('fs'); | |
const opts = github.rest.actions.listWorkflowRunArtifacts.endpoint.merge({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
run_id: ${{github.event.workflow_run.id }}, | |
}); | |
const artifacts = await github.paginate(opts); | |
for (const artifact of artifacts) { | |
if (!artifact.name.startsWith('test report ')) { | |
continue; | |
} | |
const download = await github.rest.actions.downloadArtifact({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
artifact_id: artifact.id, | |
archive_format: 'zip', | |
}); | |
fs.writeFileSync('${{github.workspace}}/' + artifact.name + '.zip', Buffer.from(download.data)); | |
} | |
- run: | | |
set -xeuo pipefail | |
pwd | |
ls | |
for archive in *.zip; do | |
name=$(basename "$archive" .zip) | |
mkdir "$name" | |
(cd "$name" && unzip ../"$archive") | |
done | |
# Process unit and integration test reports | |
- uses: scacap/action-surefire-report@v1 | |
with: | |
# this workflow should never fail, as it is not a quality gateway | |
fail_if_no_tests: false | |
commit: ${{github.event.workflow_run.head_sha}} |