File: ci-done.yml

package info (click to toggle)
nsscache 0.49-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 19,664 kB
  • sloc: python: 8,661; xml: 584; sh: 304; makefile: 19
file content (47 lines) | stat: -rw-r--r-- 1,656 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
name: Comment CI test results on PR
on:
  workflow_run:
    workflows: ["CI"]
    types:
      - completed
jobs:
  comment:
    runs-on: ubuntu-latest
    permissions:
      # list and download
      actions: read
      # post results as comment
      pull-requests: write
      # publish creates a check run
      checks: write
    steps:
      - uses: actions/github-script@v6
        with:
          script: |
            var artifacts = await github.rest.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 == "test-results"
            })[0];
            var download = await github.rest.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}}/test-results.zip', Buffer.from(download.data));
      - id: unpack
        run: |
          mkdir -p test-results
          unzip -d test-results test-results.zip
          echo "::set-output name=sha::$(cat test-results/sha-number)"
      - uses: docker://ghcr.io/enricomi/publish-unit-test-result-action:v1.6
        with:
          commit: ${{ steps.unpack.outputs.sha }}
          check_name: Unit Test Results
          github_token: ${{ secrets.GITHUB_TOKEN }}
          files: "**/test-results/**/*.xml"