ArtiomTr/jest-coverage-report-action

HttpError on v2.3.0

tallseth opened this issue ยท 1 comments

Describe a bug

Since March 4, 2024, we started getting errors like below when using the reporter. Specifying v2.2.6 explicitly fixed it, it appears to be related to one of the weekend releases.

Begin failed tests' annotations publication...
Failed tests' annotations publication failed
Error: HttpError: Resource not accessible by integration
HttpError: Resource not accessible by integration
    at /home/runner/work/_actions/ArtiomTr/jest-coverage-report-action/v2/dist/index.js:8:324893
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async tb (/home/runner/work/_actions/ArtiomTr/jest-coverage-report-action/v2/dist/index.js:2145:14436)
    at async /home/runner/work/_actions/ArtiomTr/jest-coverage-report-action/v2/dist/index.js:2145:16410
    at async wr (/home/runner/work/_actions/ArtiomTr/jest-coverage-report-action/v2/dist/index.js:2136:158)
    at async LN (/home/runner/work/_actions/ArtiomTr/jest-coverage-report-action/v2/dist/index.js:2145:16264)

Expected behavior

No error

Details

  • Action version: v2 is what we specified, was actually running v2.3.0
  • OS, where your action is running (windows, linux): ubuntu

action yaml snippet:

  test:
    name: "Test"
    runs-on: "ubuntu-latest"
    permissions:
      contents: "read"
      id-token: "write"
      pull-requests: "write"
    steps:
      - name: "๐Ÿ›’ Checkout"
        uses: actions/checkout@v4
      - name: "๐Ÿ”ง Setup and Install Dependencies"
        uses: "./.github/actions/setup-node"
      - name: "๐Ÿงช Test"
        run: |
          pnpm test:ci
      - name: ๐Ÿ“Š Coverage
        uses: ArtiomTr/jest-coverage-report-action@v2
        with:
          skip-step: "all"
          annotations: "failed-tests"
          working-directory: app
          coverage-file: "report.json"
          base-coverage-file: "report.json"

Workaround

Use version v2.2.6, like so:

      - name: ๐Ÿ“Š Coverage
        uses: ArtiomTr/jest-coverage-report-action@v2.2.6
        with:
          skip-step: "all"
          annotations: "failed-tests"
          working-directory: app
          coverage-file: "report.json"
          base-coverage-file: "report.json"

Hey @tallseth,

I've tried running v2.2.6 and looks like it throws same error as v2.3.0, when trying to create failed-tests annotations. The only difference is that v2.3.0 creates check for tests annotations even if they aren't failing - this is a part of #383 fix.

So, in your case, the fix would be to add checks: write permission:

  test:
    name: "Test"
    runs-on: "ubuntu-latest"
    permissions:
      contents: "read"
      id-token: "write"
      pull-requests: "write"
      checks: "write" # <--------- here
    steps:
      - name: "๐Ÿ›’ Checkout"
        uses: actions/checkout@v4
      - name: "๐Ÿ”ง Setup and Install Dependencies"
        uses: "./.github/actions/setup-node"
      - name: "๐Ÿงช Test"
        run: |
          pnpm test:ci
      - name: ๐Ÿ“Š Coverage
        uses: ArtiomTr/jest-coverage-report-action@v2
        with:
          skip-step: "all"
          annotations: "failed-tests"
          working-directory: app
          coverage-file: "report.json"
          base-coverage-file: "report.json"

I'll open another issue, to report more user-friendly error on such failure