1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-30 04:27:45 +00:00

Merge pull request #4015 from tertsdiepraam/ci-post-gnu-comment

CI: run GnuComment also if pipeline fails
This commit is contained in:
Sylvestre Ledru 2022-10-09 15:20:34 +02:00 committed by GitHub
commit e578502e99
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 16 deletions

View file

@ -1,7 +1,5 @@
name: Comment on GNU test results on the PR name: GnuComment
# read-write repo token
# access to secrets
on: on:
workflow_run: workflow_run:
workflows: ["GnuTests"] workflows: ["GnuTests"]
@ -9,35 +7,34 @@ on:
- completed - completed
jobs: jobs:
upload: post-comment:
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: > if: >
github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.event == 'pull_request'
github.event.workflow_run.conclusion == 'success'
steps: steps:
- name: 'Download artifact' - name: 'Download artifact'
uses: actions/github-script@v3.1.0 uses: actions/github-script@v3.1.0
with: with:
script: | script: |
# List all artifacts from GnuTests // List all artifacts from GnuTests
var artifacts = await github.actions.listWorkflowRunArtifacts({ var artifacts = await github.actions.listWorkflowRunArtifacts({
owner: context.repo.owner, owner: context.repo.owner,
repo: context.repo.repo, repo: context.repo.repo,
run_id: ${{github.event.workflow_run.id }}, run_id: ${{ github.event.workflow_run.id }},
}); });
# Download the "comment" artifact, which contains a PR number (NR) and result.txt // Download the "comment" artifact, which contains a PR number (NR) and result.txt
var matchArtifact = artifacts.data.artifacts.filter((artifact) => { var matchArtifact = artifacts.data.artifacts.filter((artifact) => {
return artifact.name == "comment" return artifact.name == "comment"
})[0]; })[0];
var download = await github.actions.downloadArtifact({ var download = await github.actions.downloadArtifact({
owner: context.repo.owner, owner: context.repo.owner,
repo: context.repo.repo, repo: context.repo.repo,
artifact_id: matchArtifact.id, artifact_id: matchArtifact.id,
archive_format: 'zip', archive_format: 'zip',
}); });
var fs = require('fs'); var fs = require('fs');
fs.writeFileSync('${{github.workspace}}/comment.zip', Buffer.from(download.data)); fs.writeFileSync('${{ github.workspace }}/comment.zip', Buffer.from(download.data));
- run: unzip comment.zip - run: unzip comment.zip
- name: 'Comment on PR' - name: 'Comment on PR'

View file

@ -244,6 +244,7 @@ jobs:
fi fi
if test -n "${have_new_failures}" ; then exit -1 ; fi if test -n "${have_new_failures}" ; then exit -1 ; fi
- name: Upload comparison log (for GnuComment workflow) - name: Upload comparison log (for GnuComment workflow)
if: success() || failure() # run regardless of prior step success/failure
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
name: comment name: comment