Annotate checks #2
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: ["ci", "docs"] | |
types: | |
- completed | |
defaults: | |
run: | |
shell: bash --noprofile --norc -euo pipefail {0} | |
jobs: | |
annotate: | |
if: github.repository_owner == 'trinodb' | |
runs-on: ubuntu-latest | |
steps: | |
- name: 'Download artifact' | |
uses: actions/github-script@v6 | |
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 -x | |
pwd | |
ls | |
for archive in *.zip; do | |
# $archive is literally *.zip if there are no zip files matching the glob expression | |
[ -f "$archive" ] || continue | |
name=$(basename "$archive" .zip) | |
mkdir "$name" | |
(cd "$name" && unzip ../"$archive") | |
done | |
# Process unit and integration test reports | |
- uses: scacap/[email protected] | |
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}} | |
# Process Product Test reports | |
- uses: starburstdata/[email protected] | |
with: | |
# this workflow should never fail, as it is not a quality gateway | |
fail_if_empty: false | |
commit: ${{github.event.workflow_run.head_sha}} | |
github_token: ${{ github.token }} |