Getting 422 error while trying to use Coveralls with GitHub actions

Question:

I’m trying to set up Coveralls to work with GitHub Actions for a Python project, and although I’ve reviewed the documentation multiple times and followed all the instructions to the best of my understanding, I’m still facing the following error:

Bad Response 422 {“message”: “Couldn’t find a repository matching this
job”, “error”: true}

Here is a minimal version of my YAML file:

name: coveralls
on:
  pull_request:
    branches:
      - main
jobs:
  tests:
    runs-on: ubuntu-latest
    steps:
      - name: checkout
        uses: actions/checkout@v3
      - name: setup python
        uses: actions/setup-python@v4
        with:
          python-version: '3.9'
      - name: install requirements
        run: |
          pip install --upgrade pip
          pip install pytest
          pip install pytest-cov
          pip install -r app/requirements.txt
      - name: run tests
        run: |
          pytest --cov=app
          coverage report -m
          coverage lcov
      - name: upload coveralls
        uses: coverallsapp/github-action@master
        with:
          github-token: ${{ secrets.GH_TOKEN }}
          path-to-lcov: coverage.lcov
Asked By: Tamar Gogoladze

||

Answers:

The documentation is not clear enough at this point:

Name Requirement Description
github-token required Must be in form github-token: ${{ secrets.GITHUB_TOKEN }}; Coveralls uses this token to verify the posted coverage data on the repo and create a new check based on the results. It is built into Github Actions and does not need to be manually specified in your secrets store. More Info

While it suggests that the GitHub token does not require manual specification in your secrets store, it is presented as a recommendation rather than a strict rule. It would be more appropriate to state that "it must not be manually specified", since using a custom variable like GH_TOKEN instead of the default GITHUB_TOKEN will not function properly.

That being said, you need to replace this line:

github-token: ${{ secrets.GH_TOKEN }}

with this line:

github-token: ${{ secrets.GITHUB_TOKEN }}
Answered By: Andreas Violaris