mirror of
https://github.com/uutils/findutils.git
synced 2026-06-10 15:48:30 -07:00
114b1bc247
Bumps [actions/github-script](https://github.com/actions/github-script) from 8 to 9. - [Release notes](https://github.com/actions/github-script/releases) - [Commits](https://github.com/actions/github-script/compare/v8...v9) --- updated-dependencies: - dependency-name: actions/github-script dependency-version: '9' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com>
76 lines
2.5 KiB
YAML
76 lines
2.5 KiB
YAML
on:
|
|
workflow_run:
|
|
workflows: [External-testsuites]
|
|
types: [completed]
|
|
|
|
name: Comment Test results on the PR
|
|
|
|
permissions: {}
|
|
jobs:
|
|
upload-pr-comment:
|
|
if: ${{ github.event.workflow_run.event == 'pull_request' }}
|
|
|
|
name: Upload PR comment
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
actions: read
|
|
pull-requests: write
|
|
|
|
steps:
|
|
- name: List Annotations
|
|
uses: actions/github-script@v9
|
|
with:
|
|
script: |
|
|
let artifacts = await github.rest.actions.listWorkflowRunArtifacts({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
run_id: ${{ github.event.workflow_run.id }},
|
|
});
|
|
|
|
// List all artifacts
|
|
let matchArtifact = artifacts.data.artifacts.filter((artifact) => {
|
|
return artifact.name == "comment"
|
|
})[0];
|
|
|
|
// Download the artifact to github.workspace
|
|
let download = await github.rest.actions.downloadArtifact({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
artifact_id: matchArtifact.id,
|
|
archive_format: 'zip',
|
|
});
|
|
|
|
let fs = require('fs');
|
|
fs.writeFileSync('${{ github.workspace }}/comment.zip', Buffer.from(download.data));
|
|
|
|
- run: unzip comment.zip
|
|
|
|
- name: Comment on PR
|
|
uses: actions/github-script@v9
|
|
with:
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
script: |
|
|
let fs = require('fs');
|
|
let annotations = JSON.parse(fs.readFileSync('./annotations.json', 'utf8'));
|
|
|
|
let annotationContent = annotations
|
|
.data
|
|
.map(annotation => `${annotation.run}: ${annotation.annotation.message}`)
|
|
.join('\n');
|
|
|
|
// check if no changes
|
|
let gnuTestReport = annotationContent.includes('Run GNU findutils tests: Gnu tests No changes');
|
|
let bfsTestReport = annotationContent.includes('Run BFS tests: BFS tests No changes');
|
|
|
|
if (gnuTestReport && bfsTestReport) {
|
|
console.log('No changes');
|
|
return;
|
|
}
|
|
|
|
// Comment on the PR
|
|
github.rest.issues.createComment({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
issue_number: annotations.pull_request_number,
|
|
body: 'Commit ${{ github.event.workflow_run.head_sha }} has GNU testsuite comparison:\n```\n' + annotationContent + '\n```\n'
|
|
}); |