2021-04-11 14:22:44 +02:00
|
|
|
name: Transifex
|
|
|
|
on: [pull_request]
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
messages:
|
|
|
|
name: Check messages.po changes
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Install gettext
|
|
|
|
run: sudo apt-get install gettext
|
|
|
|
|
|
|
|
- name: Checkout Friendica Base
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
repository: 'friendica/friendica'
|
|
|
|
ref: ${{ github.base_ref }}
|
|
|
|
|
|
|
|
- name: Checkout current Friendica Addons
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
with:
|
2021-04-11 20:55:44 +02:00
|
|
|
path: 'addon'
|
2021-04-11 14:22:44 +02:00
|
|
|
|
|
|
|
- name: Get changed files
|
|
|
|
id: changes
|
|
|
|
uses: jitterbit/get-changed-files@v1
|
|
|
|
|
|
|
|
- name: Run Xgettext for each changed addon
|
|
|
|
run: |
|
2021-04-11 20:55:44 +02:00
|
|
|
addon_files=(${{ steps.changes.outputs.all }})
|
|
|
|
find_result=$(printf "%s\n" "${addon_files[@]}" | sed '/^\./d' | cut -d "/" -f1 | uniq)
|
2021-04-11 14:22:44 +02:00
|
|
|
for addon in $find_result
|
|
|
|
do
|
|
|
|
./bin/run_xgettext.sh --addon $addon
|
|
|
|
done
|
|
|
|
|
|
|
|
- name: Check if messages.po needs an update
|
|
|
|
run: |
|
|
|
|
echo "::group::Check messages.po"
|
|
|
|
# Skip all lines of the git diff starting with "@@" or comments or starting "POT-Creation-Date"
|
2021-04-11 20:55:44 +02:00
|
|
|
cd addon/
|
2021-04-11 14:22:44 +02:00
|
|
|
if [[ $(git diff -U0 "**/messages.po" | awk '!/index|diff|\-\-\-|\+\+\+|@@|\-"POT-Creation-Date|\+"POT-Creation-Date|\+#|\-#/{print }' | wc -l) > 0 ]]; then
|
|
|
|
echo "::error file=messages.po::messages.po is out of date"
|
|
|
|
exit 1
|
|
|
|
else
|
|
|
|
echo "Nothing to update"
|
|
|
|
fi
|
|
|
|
echo "::endgroup::"
|
|
|
|
shell: bash
|