diff --git a/.github/scripts/download-translations.js b/.github/scripts/download-translations.js index 62f63a6a0..918be97d3 100644 --- a/.github/scripts/download-translations.js +++ b/.github/scripts/download-translations.js @@ -57,11 +57,12 @@ async function downloadTranslations() { }); } - // Save file - const outputPath = path.join(process.cwd(), 'temp', `${language}.json`); + // Determine the output filename based on language + const filename = language === 'en' ? 'gb.json' : `${language}.json`; + const outputPath = path.join(process.cwd(), 'temp', filename); 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!'); diff --git a/.github/workflows/poeditor-sync.yml b/.github/workflows/poeditor-sync.yml index 1f1194e3e..b26d47a39 100644 --- a/.github/workflows/poeditor-sync.yml +++ b/.github/workflows/poeditor-sync.yml @@ -17,15 +17,24 @@ on: schedule: - cron: "0 0 * * *" +permissions: + contents: write + pull-requests: write + jobs: sync-translations: runs-on: ubuntu-latest + permissions: + contents: write + issues: write + pull-requests: write steps: - name: Checkout code uses: actions/checkout@v3 with: token: ${{ secrets.GITHUB_TOKEN }} + fetch-depth: 0 - name: Setup Node.js uses: actions/setup-node@v3 @@ -83,10 +92,27 @@ jobs: cp -r temp/* src/locales/ echo "Translation files copied to src/locales/" - - name: Commit changes - run: | - git config --local user.email "github-actions[bot]@users.noreply.github.com" - git config --local user.name "github-actions[bot]" - git add src/locales/*.json - git diff --staged --quiet || git commit -m "Translations updated from POEditor" - git push + - name: Get current date + id: date + run: echo "date=$(date +'%Y-%m-%d %H:%M:%S')" >> $GITHUB_OUTPUT + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v6 + 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 + author: GitHub Action diff --git a/src/locales/tr.json b/src/locales/tr.json index f008db6fa..6f56a8246 100644 --- a/src/locales/tr.json +++ b/src/locales/tr.json @@ -175,5 +175,5 @@ }, "testNotificationDevelop": "" }, - "testLocale": "TEST4 UPLOAD" + "testLocale": "TEST5 UPLOAD" } \ No newline at end of file