Tidy modules on renovate branches

Signed-off-by: Paul Meyer <49727155+katexochen@users.noreply.github.com>
This commit is contained in:
Paul Meyer 2022-10-18 17:33:21 +02:00
parent 7c13302936
commit a6b0edfcaa

View File

@ -40,6 +40,28 @@ jobs:
echo "submods=${mods}" >> $GITHUB_OUTPUT
- name: Go tidy check
id: tidycheck
uses: katexochen/go-tidy-check@45731e0013a976d5d616d79007c7ba52de6ce542 # tag=v1.0.2
with:
modules: ${{ steps.submods.outputs.submods }}
# The following steps are only executed if the previous tidy check failed
# and the action runs on an renovat branche. In this case, we tidy all
# modules again and commit the changes, so the user doesn't need to do it.
- name: Tidy modules on renovate branches
if: ${{ failure() && (steps.tidycheck.conclusion == 'failure') && startsWith(github.head_ref, 'renovate/') }}
shell: bash
run: |
for mod in ${{ steps.submods.outputs.submods }}; do
(cd $mod; go mod tidy)
done
- name: Push changes
if: ${{ failure() && (steps.tidycheck.conclusion == 'failure') && startsWith(github.head_ref, 'renovate/') }}
shell: bash
run: |
git config --global user.name "${{ github.actor }}"
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
git commit -am "[bot] Tidy all modules"
git push