I'm running an Azure DevOps Pipeline that grabs all configuration changes from a dev server and attempts to check it in. The changes come as a zip file, but get extracted via a custom exe into smaller XML files. This is currently working fine with one exception, the zip file is always different, even though the extracted XML files are not. I do not want to check in the zip file changes if only the zip files have changed (so I only want to check in the changes if more than 2 files are different, since there are two zip files)
I was thinking of trying to use git show --shortstat to get the number of file changes, and if it is two, skip it, but I don't know how to make it work. Here is my current Pipeline YAML:
# -----------------
# Check solution into Git
# -----------------
- script: |
COPY "$(Build.ArtifactStagingDirectory)\${{ parameters.solutionName }}.zip" "$(Build.SourcesDirectory)\${{ parameters.solutionGitFolderPath }}\${{ parameters.solutionName }}.zip" /Y
COPY "$(Build.ArtifactStagingDirectory)\${{ parameters.solutionName }}_managed.zip" "$(Build.SourcesDirectory)\${{ parameters.solutionGitFolderPath }}\${{ parameters.solutionName }}_managed.zip" /Y
echo commit all changes
git config user.email "$(Build.RequestedForEmail)"
git config user.name "$(Build.RequestedFor)"
git checkout main
git add --all
git commit -m "automated"
echo push code to new repo
git -c http.extraheader="AUTHORIZATION: bearer $(System.AccessToken)" push origin main
displayName: 'Commit / Push to Git Repo'