pytest-coverage-commentator icon indicating copy to clipboard operation
pytest-coverage-commentator copied to clipboard

Workflow failed! Resource not accessible by integration

Open krkeegan opened this issue 4 years ago • 3 comments

I am getting the error Workflow failed! Resource not accessible by integration

I am using the following workflow. Everything works fine if I comment out the Comment Coverage step.

name: Linting and Pytest

on:
  pull_request:
    branches:
      - dev

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - name: Set up Python 3.8
      uses: actions/setup-python@v2
      with:
        python-version: 3.8
    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
        pip install flake8 pytest
        if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
        if [ -f requirements-test.txt ]; then pip install -r requirements-test.txt; fi
    - name: Lint with flake8 exit on errors
      run: |
        # stop the build if there are Python syntax errors or undefined names
        flake8 app --count --select=E9,F63,F7,F82 --show-source --statistics
    - name: Test with pytest
      run: |
        # Skips creating coverage stats for covered items
        pytest --cache-clear --cov-report term:skip-covered --cov=app tests/ | tee pytest-coverage.txt
     - name: Comment coverage
       uses: coroo/[email protected]
       with:
         pytest-coverage: pytest-coverage.txt

krkeegan avatar Dec 18 '20 02:12 krkeegan

Hi @krkeegan ,

I think the problem since you not create pytest-coverage.txt. Please use:

    - name: Build coverage file
      run: |
        pytest --cache-clear --cov=app test/ > pytest-coverage.txt
    - name: Comment coverage
      uses: coroo/[email protected]

I think for your case should be:

    - name: Test with pytest
      run: |
        pytest --cache-clear --cov-report term:skip-covered --cov=app tests/ > pytest-coverage.txt
    - name: Comment coverage
      uses: coroo/[email protected]

coroo avatar Dec 18 '20 02:12 coroo

Hmm piping the output to tee should be creating pytest-coverge.txt. It certainly does locally. I would prefer to tee the output so that I can still get the failures in the terminal output.

krkeegan avatar Jan 05 '21 23:01 krkeegan

Have the same issue. Found solution on similar GitHub Action: Pytest Coverage Comment It uses tee in every example :)

MishaKav avatar Jun 02 '21 20:06 MishaKav