Rework Game Creation dialog #4656
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |