ArtiomTr/jest-coverage-report-action

False-positive fail check

seahindeniz opened this issue · 1 comments

Describe a bug

After tests gets failed and rerun again, previous report doesn't get cleaned up

Expected behavior

I expect, re-running a failed check should always remove the previous report, and report a new one for a new failure or report none for a success case.

Details

  • Action version:
  • OS, where your action is running (windows, linux): Linux
action.yml file
name: "Run Tests"

on:
  push:
  schedule:
    - cron: "00 10,15 * * *"

concurrency:
  group: testing-${{ github.event.pull_request.number || github.ref }}
  cancel-in-progress: true

jobs:
  test:
    runs-on: self-runner-node
    timeout-minutes: 10
    permissions:
      checks: write
      contents: write
      issues: write
      pull-requests: write
    steps:
      - name: Checkout code
        uses: actions/checkout@v3
        with:
          persist-credentials: false

      - name: Use NodeJS
        uses: actions/setup-node@v3
        with:
          node-version: 18
          cache: npm

      - name: Install dependencies
        run: npm ci --loglevel=error --no-fund --no-audit

      - name: Run tests
        id: test
        run: npm test -- --runInBand --ci --json --coverage --testLocationInResults --outputFile=report.json

      - name: Find PR
        if: always() && startsWith(github.ref, 'refs/heads/feature/')
        uses: jwalton/gh-find-current-pr@v1
        id: findPr

      - name: Report results for feature branch
        if: always() && startsWith(github.ref, 'refs/heads/feature/')
        uses: ArtiomTr/jest-coverage-report-action@v2
        with:
          skip-step: all
          coverage-file: report.json
          base-coverage-file: report.json
          output: comment
          prnumber: ${{ steps.findPr.outputs.number }}

      - name: Report results for master branch
        if: always() && github.ref == 'refs/heads/master'
        uses: ArtiomTr/jest-coverage-report-action@v2
        id: coverageForMaster
        with:
          skip-step: all
          coverage-file: report.json
          base-coverage-file: report.json
          output: report-markdown
          annotations: failed-tests

      - name: Open issue
        if: failure() && github.ref == 'refs/heads/master' && steps.test.conclusion == 'failure'
        uses: JasonEtco/create-an-issue@v2
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          testOutput: ${{ steps.coverageForMaster.outputs.report }}
        with:
          filename: .github/tests-failed.md
Screenshots
    <!-- If you encounter an incorrect coverage comment display, replace this comment with screenshot -->

    <!-- If your action unexpectedly fails, please replace this comment with a screenshot of your console  -->

</details>

Additional context

Published fix in v2.2.9