alexlaverty / python-reddit-youtube-bot

Automated Reddit Youtube Video Bot
https://www.youtube.com/channel/UCzIwW92D_rM5_yvWBsquSbw
78 stars 17 forks source link

Fixes to be able to git commit data.csv #39

Closed alexlaverty closed 1 year ago

alexlaverty commented 1 year ago

Who would of thought checking a file in to the repo would be so difficult...

If you are running a github action inside a container the version of git needs to match the version of git on the host otherwise the github action will revert to using the git cli to pull down the repository and there will be no .git folder which means any attempts to run git status, git add etc will fail because the folder is not a repo

Latest version of git is not in the apt repo so need to install git from tar source. Also due to deprecation need to update this logic :

          if git diff --exit-code data.csv; then
            echo "::set-env name=changes_exist::false"
          else
            echo "::set-env name=changes_exist::true"
          fi

to this to check if files are changed and write a ENV variable like so :

          if git diff --exit-code data.csv; then
            echo "changes_exist=true" >> $GITHUB_ENV
          else
            echo "changes_exist=false" >> $GITHUB_ENV
          fi