mirror of
https://github.com/4ian/GDevelop.git
synced 2025-10-15 10:19:04 +00:00
54 lines
2.2 KiB
YAML
54 lines
2.2 KiB
YAML
name: GDevelop Issues automatic workflow
|
|
on:
|
|
pull_request:
|
|
types:
|
|
- opened
|
|
- reopened
|
|
- synchronize
|
|
jobs:
|
|
read-locales-metadata:
|
|
if: github.event.pull_request.title == '[Auto PR] Update translations'
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
COMMENT_TITLE: "Translation ratio changes"
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
- name: Read and format locales metadata
|
|
env:
|
|
BASE: ${{ github.event.pull_request.base.sha }}
|
|
HEAD: ${{ github.event.pull_request.head.sha }}
|
|
run: |
|
|
LANS=($(git diff $BASE...$HEAD -- newIDE/app/src/locales/LocalesMetadata.js | grep -E "^\s+\"languageName" | sed -E "s/^ *\"languageName\": \"//g" | sed -E "s/\",//g" | sed -E "s/ /_/g"))
|
|
ADDS=($(git diff $BASE...$HEAD -- newIDE/app/src/locales/LocalesMetadata.js | grep -E "^\+\s*\"translationRatio\"" | sed -E "s/^\+ *\"translationRatio\": //g"))
|
|
SUBS=($(git diff $BASE...$HEAD -- newIDE/app/src/locales/LocalesMetadata.js | grep -E "^\-\s*\"translationRatio\"" | sed -E "s/^\- *\"translationRatio\": //g"))
|
|
touch sumup.md
|
|
echo "## $COMMENT_TITLE" >> sumup.md
|
|
echo "" >> sumup.md
|
|
echo "| Language | Change |" >> sumup.md
|
|
echo "| --- | --- |" >> sumup.md
|
|
for index in ${!ADDS[@]}; do
|
|
DELTA=$(echo "scale=3; (${ADDS[index]} - ${SUBS[index]})*100/1" | bc)
|
|
if (( $(echo "$DELTA == 0" | bc -l) )); then
|
|
continue
|
|
fi
|
|
LANGUAGE=${LANS[index]//_/ }
|
|
echo "| $LANGUAGE | $(printf "%1.3f" $DELTA) % |" >> sumup.md
|
|
done
|
|
- name: Find Comment
|
|
uses: peter-evans/find-comment@v2
|
|
id: fc
|
|
with:
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
issue-number: ${{ github.event.number }}
|
|
body-includes: ${{ env.COMMENT_TITLE }}
|
|
- name: Autocomment pull request with sumup
|
|
uses: peter-evans/create-or-update-comment@v3
|
|
with:
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
issue-number: ${{ github.event.number }}
|
|
comment-id: ${{ steps.fc.outputs.comment-id }}
|
|
edit-mode: replace
|
|
body-path: "sumup.md"
|