Unable to checkout all the changes done in a multi-commit push

Hallo everybody!

I was trying to setup a workflow for my repository and at some point in this process I did some fixes in three different commits.
Afterwards I pushed all the changes to remote and the workflow started as predicted (should start at every push/pull_request). What I saw afterwards was the following (the commits in the red box are the one I’ve pushed in one batch):

You can see that, the workflow was run only for the latest commit (6aeb98f).

Nothing strange so far, but what it is strange is that in that workflow I still got an error caused by the fixes I’ve implemented in the other two commits (891adf9 and e4ca824). It looks like it has performed the tests on a code which does not include the two above mentioned commits. Also what is even stranger, is that on the further next commits I did, I always got the same mistake even though the fixes are there in the code.

Can somebody help me?

Thank you very much.


EDIT: Here below you can find the workflow I’m using at the moment. The error I’ve fixed comes from lint with flake8.

# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Python application

      - master
      - migration_to_python3.4
      - master
      - migration_to_python3.4

    runs-on: ubuntu-latest

        python-version: [3.6]

    - name: Branch checkout
      uses: actions/checkout@v2
        fetch-depth: 0

    - name: Set up Python ${{ matrix.python-version }}
      uses: actions/setup-python@v2
        python-version: ${{ matrix.python-version }}

#    - name: Setup of requirement.txt
#      uses: ryan-rozario/pipreqs-action-cpy@master
#      with:
#        PROJECT_PATH: .
#        REQUIREMENT_PATH: ./requirement.txt

    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
        pip install pytest flake8 pytest-cov
        pip install -r requirement.txt

    - name: Lint with flake8
      run: |
        # stop the build if there are Python syntax errors or undefined names
        flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
        # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
        flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics

    - name: Test with pytest
      run: |


What error did the workflow run return?
If possible, please share your repository with us, so that we can check the detailed error message and more detailed configurations related to the workflow to analyze the root cause.

The error was related to a mistake in the code, and it was spotted by flake8:

The thing is that I’ve then fixed this in the repository, but everytime I run the workflow it still gave me the exact same error as above, as if I didn’t changed anything.

The exit code I get is “1” (Process completed with exit code 1).

Unfortunately I can’t share the repository…

Thank you for your support

So now I tried to “print” in the terminal one of the files that causes troubles (factory.py), to see if the files that I’m checking out are right.

Above you can see one of the error in this factory.py triggered by flake8 is not present anymore in the file. Looks like flake8 is somehow acting on an old version…


When checkout, by default the HEAD will be switched to the latest commit that triggered the workflow. On this commit, normally it should refer to the latest version of all the code files.

According to your comments, it seems that the HEAD does not refer to the latest version of the code files.
Please check the logs of the checkout action in your workflow run to see if the HEAD had been switched to the latest commit of the push. The logs should look like this:

And you also need to check if the subsequent steps will switch the HEAD to another Git ref (branch, tag or commit).

You can use the following git commands to print the commit message and commit SHA of current HEAD.

git show-branch --current
git show-ref --head

Thank you for the suggestions, I will try so!


How are things going?
Have you tried my above suggestions? Are they helpful?
Please try them, and any update, feel free to tell us.

I tried and it was not working, then I discovered the issue (very stupid issue). Basically there was a folder in the git repository with old code, sort of a backup of an old version which didn’t have my changes. Pytest was running the test on that folder instead of the proper one, causing this stupid issue.
Thank you very much for your ideas and support!


You’re welcome, @freydavide .
And glad that you have found the root cause and solved the problem.