Skip to content

Commit fadcb21

Browse files
committed
Fix git add/commit/push steps
merge job was not adding changes due to missing --cached flag make push failed to add untracked files. This commit aims to tackle these issues.
1 parent 78288a1 commit fadcb21

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

.github/workflows/update.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ jobs:
218218
git config user.email github-actions@github.com
219219
git diff -I'^"POT-Creation-Date: ' --numstat *.po **/*.po | cut -f3 | xargs -r git add
220220
git add $(git ls-files -o --exclude-standard *.po **/*.po) .tx/config
221-
git diff-index --quiet HEAD || git commit -m "Merge ${{ env.CURRENT_BRANCH }} into ${{ matrix.branch }}"
221+
git diff-index --cached --quiet HEAD || git commit -m "Merge ${{ env.CURRENT_BRANCH }} into ${{ matrix.branch }}"
222222
working-directory: ${{ matrix.branch }}
223223

224224

Makefile

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -77,16 +77,11 @@ build: setup po-install
7777
# git-added (staged); otherwise, it does nothing.
7878
# The MSG variable has a default commit message, but one can override it
7979
# e.g. make push MSG='my message'
80-
push: MSG := Update translations from Transifex
8180
push:
82-
@CHANGED=$(shell git diff -I'^"POT-Creation-Date: ' --numstat *.po **/*.po | cut -f3); \
83-
NEW=$(shell git ls-files -o *.po **/*.po); \
84-
if [[ "$$CHANGED$$NEW" != "" ]]; then \
85-
git commit -m '$(MSG)' $$CHANGED $$NEW .tx/config; \
86-
git push; \
87-
else \
88-
echo 'Nothing to commit'; \
89-
fi
81+
git diff -I'^"POT-Creation-Date: ' --numstat *.po **/*.po | cut -f3 | xargs -r git add
82+
git add $(shell git ls-files -o *.po **/*.po) .tx/config
83+
git diff-index --cached --quiet HEAD || \
84+
{ git commit -m "Update translations from Transifex" && git push; }
9085

9186

9287
# pull: Download translations files from Transifex, and apply line wrapping.

0 commit comments

Comments
 (0)