Open pull request for translations (#1939)
* fix: open pull request for translations * fix: permission update * fix: permission update * fix: permission update * fix: permission update
This commit is contained in:
1 parent
d8f534217f
commit
32389eaf67
3 files changed
+38
-11
No files matched your search
@@ -57,11 +57,12 @@ async function downloadTranslations() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save file
|
// Determine the output filename based on language
|
||||||
const outputPath = path.join(process.cwd(), 'temp', `${language}.json`);
|
const filename = language === 'en' ? 'gb.json' : `${language}.json`;
|
||||||
|
const outputPath = path.join(process.cwd(), 'temp', filename);
|
||||||
await fs.writeJson(outputPath, formattedTranslations, { spaces: 2 });
|
await fs.writeJson(outputPath, formattedTranslations, { spaces: 2 });
|
||||||
|
|
||||||
console.log(`Translations for ${language} language successfully downloaded and saved: ${outputPath}`);
|
console.log(`Translations for ${language} language successfully downloaded and saved as: ${filename}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('All translations successfully downloaded!');
|
console.log('All translations successfully downloaded!');
|
||||||
|
|||||||
@@ -17,15 +17,24 @@ on:
|
|||||||
schedule:
|
schedule:
|
||||||
- cron: "0 0 * * *"
|
- cron: "0 0 * * *"
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
pull-requests: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
sync-translations:
|
sync-translations:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
issues: write
|
||||||
|
pull-requests: write
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Setup Node.js
|
- name: Setup Node.js
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v3
|
||||||
@@ -83,10 +92,27 @@ jobs:
|
|||||||
cp -r temp/* src/locales/
|
cp -r temp/* src/locales/
|
||||||
echo "Translation files copied to src/locales/"
|
echo "Translation files copied to src/locales/"
|
||||||
|
|
||||||
- name: Commit changes
|
- name: Get current date
|
||||||
run: |
|
id: date
|
||||||
git config --local user.email "github-actions[bot]@users.noreply.github.com"
|
run: echo "date=$(date +'%Y-%m-%d %H:%M:%S')" >> $GITHUB_OUTPUT
|
||||||
git config --local user.name "github-actions[bot]"
|
|
||||||
git add src/locales/*.json
|
- name: Create Pull Request
|
||||||
git diff --staged --quiet || git commit -m "Translations updated from POEditor"
|
uses: peter-evans/create-pull-request@v6
|
||||||
git push
|
with:
|
||||||
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
commit-message: "feat: translations updated from POEditor"
|
||||||
|
title: "🌐 Updated Translations from POEditor"
|
||||||
|
body: |
|
||||||
|
This PR contains the latest translations from POEditor.
|
||||||
|
|
||||||
|
📅 Update Date: ${{ steps.date.outputs.date }}
|
||||||
|
🔄 Updated Languages: ${{ github.event.inputs.languages || 'tr,en' }}
|
||||||
|
|
||||||
|
⚠️ Please review the translations and approve the PR if everything looks correct.
|
||||||
|
branch: translation-update-${{ github.run_number }}
|
||||||
|
delete-branch: true
|
||||||
|
base: develop
|
||||||
|
add-paths: |
|
||||||
|
src/locales/*.json
|
||||||
|
committer: GitHub Action <github-actions[bot]@users.noreply.github.com>
|
||||||
|
author: GitHub Action <github-actions[bot]@users.noreply.github.com>
|
||||||
+1
-1
@@ -175,5 +175,5 @@
|
|||||||
},
|
},
|
||||||
"testNotificationDevelop": ""
|
"testNotificationDevelop": ""
|
||||||
},
|
},
|
||||||
"testLocale": "TEST4 UPLOAD"
|
"testLocale": "TEST5 UPLOAD"
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user