[solved] Workflows and git logs

I’m using this workflow. It download every day some JSON files, and if there is some diff it push to the repo (using actions/checkout@v2).

I have a stupid problem which I think depends on the fact that I have not understood how things work.

If I run in my workflow (via a sh script)

git log --since="2020-06-21T13:03:51 +0000" --date=iso --all --no-merges >log.txt

I have a very small log, something like

commit 735df05897e61ac27e21b4b50504e4c7721649fd
Author: Andrea Borruso <aborruso@....>
Date:   2020-07-04 10:12:53 +0200


If I run the same command in my local, I have much more rows, I have the complete log info that I need.

How to create the complete log output via workflow? Maybe I need to run git pull first?

Thank you

The repository seems to be private so I can’t see the workflow, but the log you describe looks like you run actions/checkout with the default fetch-depth of 1, which means to get only the latest commit (enough for the common use of “build and run tests”).

To get more you can either increase the number, or set fetch-depth to 0 to fetch all commits.

1 Like

I’m sorry, now is public

Yep, looks like it’s the fetch-depth. So if you want to see the whole log you should do:

    runs-on: ubuntu-latest
    - name: Utilizza l'action github checkout@v2, per automatizzare il check-out
      uses: actions/checkout@v2
        fetch-depth: 0

If you don’t need the whole log, just a bunch more entries, you can set a number of commits to fetch instead of the zero.

1 Like

Thank you very much, it works

1 Like