Skip to content

Commit

Permalink
Modernize auto-updates
Browse files Browse the repository at this point in the history
  • Loading branch information
EduardGomezEscandell committed Nov 20, 2023
1 parent 9159f53 commit 9ad46f6
Showing 1 changed file with 23 additions and 23 deletions.
46 changes: 23 additions & 23 deletions .github/workflows/auto-updates.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,21 +35,19 @@ jobs:
- name: Check po files
id: checkpo
run: |
# Generate locales
set -eu
hasModif="false"
for subproject in ${{ env.subprojects }} ; do
go generate "${subproject}/generate/generate-locales.go"
done
# Exclude line diffs only
MODIFIED=$(git difftool -y -x "diff -Nup -I '^#: '" "*/po/*")
if [ -n "$MODIFIED" ]; then
hasModif="true"
fi
echo "modified=${hasModif}" >> $GITHUB_OUTPUT
- name: Find localization changes
id: check-diff
uses: canonical/desktop-engineering/gh-actions/common/has-diff@main
with:
working-directory: .
# Go workflow files tend to update when no one is asking
paths-to-ignore: 'go.work.sum'
fail-on-diff: false
- name: Create Pull Request
if: steps.checkpo.outputs.modified == 'true'
uses: peter-evans/create-pull-request@v5
Expand Down Expand Up @@ -88,24 +86,26 @@ jobs:
name: Set up Go
with:
go-version-file: go.work
- name: Check README file
id: check-readme
- name: Generate documentation
run: |
# Generate documentation
set -eu
for subproject in ${{ env.subprojects }} ; do
go generate "${subproject}/generate/generate-docs.go"
done
hasModif="false"
MODIFIED=$(git status --porcelain --untracked-files=no)
if [ -n "$MODIFIED" ]; then
hasModif="true"
fi
echo "modified=${hasModif}" >> $GITHUB_OUTPUT
- name: Find documentation changes
id: check-diff
uses: canonical/desktop-engineering/gh-actions/common/has-diff@main
with:
working-directory: .
# Go workflow files tend to update when no one is asking
paths-to-ignore: 'go.work.sum'
regexp-to-ignore: >-
diff -Nup -I '^#: '
fail-on-diff: false
- uses: peter-evans/create-pull-request@v5
name: Create Pull Request
if: steps.check-readme.outputs.modified == 'true'
if: steps.check-diff.outputs.diff == 'true'
with:
commit-message: Auto update readme files
title: 'docs: Auto update readme files'
Expand All @@ -114,7 +114,7 @@ jobs:
branch: auto-updates/readme-cli-ref
token: ${{ secrets.GITHUB_TOKEN }}
- name: Push branch
if: steps.check-readme.outputs.modified == 'true'
if: steps.check-diff.outputs.diff == 'true'
run: |
git push origin auto-updates/readme-cli-ref:main
Expand Down

0 comments on commit 9ad46f6

Please sign in to comment.