fix: add the account name to prompt #11
Workflow file for this run
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: Check i18n Changes | |
on: | |
pull_request: | |
paths: | |
- "src/i18n/locales/en/translation.json" | |
types: | |
- opened | |
- synchronize | |
jobs: | |
check-i18n-changes: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 2 | |
- name: Check for i18n changes | |
run: | | |
BASE_CONTENT=$(curl -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" -H "Accept: application/vnd.github.v3.raw" -s "https://api.github.com/repos/${{ github.repository }}/contents/src/i18n/en/translation.json?ref=${{ github.event.pull_request.base.ref }}") | |
echo $BASE_CONTENT | |
CHANGED_FILES=$(git diff --name-only ${{ github.event.pull_request.base.sha }}) | |
if echo "$CHANGED_FILES" | grep -q 'src/i18n/locales/en/translation.json'; then | |
CHANGES=$(git diff --unified=0 ${{ github.event.before }} ${{ github.sha }} -- src/i18n/locales/en/translation.json | grep '^\+' | grep -v '+++' | grep -v '^{+"translation": {+$' | jq -r '. | select(. != null)' || true) | |
if [ -n "$CHANGES" ]; then | |
echo "Changes detected in translation file." | |
echo "$CHANGES" | jq -r 'gsub("^[+]"; "") | gsub("\""; "\\\"") | "Key \(.[:100]) has changed"' | |
exit 1 | |
fi | |
else | |
echo "Translation file has not been modified." | |
fi |