fgrosse / go-coverage-report

A CLI tool and GitHub Action to post Go code coverage reports as comment to your pull requests.
BSD 3-Clause "New" or "Revised" License
53 stars 8 forks source link

Error fetching artifacts #23

Closed peter-crist closed 3 months ago

peter-crist commented 3 months ago

Getting the following 403 when the script is trying to fetch the current run coverage results:

Run $GITHUB_ACTION_PATH/scripts/github-action.sh "test" "7766" "9372917987"
+ gh run download 9372917987 --name=unit-test-output --dir=.github/outputs
Download code coverage results from current run
  error fetching artifacts: HTTP 403: Resource not accessible by integration

Current usage looks like:

  code_coverage:
    name: "Code coverage report"
    if: github.event_name == 'pull_request'
    runs-on: self-hosted
    needs: 
      - inputs
      - unit-test
    steps:
      - uses: actions/checkout@v3
      - uses: fgrosse/go-coverage-report@v1.0.1
        with:
          coverage-artifact-name: unit-test-output
          coverage-file-name: ${{ inputs.project-path }}/unitcoverage.out

where the unit-test job has a successful upload:

      - name: Upload report artifact
        uses: actions/upload-artifact@v3
        with:
          name: unit-test-output
          path: |
            ${{ inputs.project-path }}/unitcoverage.out

Names and paths are correct but getting a 403 on the gh run download call. Setup job shows:

 GITHUB_TOKEN Permissions
  Contents: read
  Metadata: read
  Packages: read
  PullRequests: write
Secret source: Actions
peter-crist commented 3 months ago

This was a matrix workflow so the prior parent workflow needed the permissions update to actions: read as well.