github.com/dgraph-io/ristretto@v0.1.2-0.20240116140435-c67e07994f91/.github/workflows/ci-ristretto-report-coverage.yml (about)

     1  name: ci-ristretto-report-coverage
     2  # this workflow has access to repository secrets
     3  # separate workflow required to sanitize input from community PR's
     4  on:
     5    workflow_run:
     6      workflows: ["ci-ristretto-tests"]
     7      types:
     8        - completed
     9  jobs:
    10    report-coverage:
    11      runs-on: ubuntu-20.04
    12      if: >
    13        (github.event.workflow_run.event == 'pull_request' ||
    14        github.event.workflow_run.event == 'push' ) &&
    15        github.event.workflow_run.conclusion == 'success'
    16      steps:
    17        - uses: actions/checkout@v4
    18          with:
    19            ref: ${{ github.event.workflow_run.head_branch }}
    20        - name: 'Download coverage profile'
    21          uses: actions/github-script@v3.1.0
    22          with:
    23            script: |
    24              var artifacts = await github.actions.listWorkflowRunArtifacts({
    25                 owner: context.repo.owner,
    26                 repo: context.repo.repo,
    27                 run_id: ${{github.event.workflow_run.id }},
    28              });
    29              var matchArtifact = artifacts.data.artifacts.filter((artifact) => {
    30                return artifact.name == "covprofile"
    31              })[0];
    32              var download = await github.actions.downloadArtifact({
    33                 owner: context.repo.owner,
    34                 repo: context.repo.repo,
    35                 artifact_id: matchArtifact.id,
    36                 archive_format: 'zip',
    37              });
    38              var fs = require('fs');
    39              fs.writeFileSync('${{github.workspace}}/covprofile.zip', Buffer.from(download.data));
    40        - run: unzip covprofile.zip
    41        - name: Send coverage
    42          env:
    43            COVERALLS_TOKEN: ${{ secrets.COVERALLSIO_TOKEN }}
    44          uses: shogo82148/actions-goveralls@v1
    45          with:
    46            path-to-profile: ./covprofile