I'm using this script to generate a file with commit dates
cat .github/workflows/header.md > "COVID 19/fechas.md"
git ls-tree -r --name-only HEAD COVID\ 19/*.csv | while read filename; do
date=$(git log -1 --format="%aD" -- "$filename")
echo "| $date | $filename |" >> "COVID 19/fechas.md"
done
git config --global user.email "[email protected]"
git config --global user.name "FechaActionBot"
git add "COVID 19/fechas.md"
git commit -m "Fichero de fechas generado"
In this GitHub Action, which checks out the code and runs above as a script.
No matter what I use as format (commiter or author date), I get the same result, which shows the same date (the current one) for all files.
By default, the checkout action does a shallow clone. You need to configure it for a deep clone, as indicated, if you want to access the real commit date (and not the date of a ghost commit created by the shallow clone), this way:
name: genera fechas
on:
push:
paths:
- '**.csv'
jobs:
genera_fechas:
runs-on: ubuntu-latest
name: Genera CSV
steps:
- name: checkout
uses: actions/checkout@v2
with:
fetch-depth: '0'
- name: Fechas
run: .github/workflows/dates.sh
- name: Check in
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With