|
| 1 | +name: Create translation pull request J6 |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ translation6 ] |
| 6 | + |
| 7 | + workflow_dispatch: |
| 8 | + |
| 9 | + schedule: |
| 10 | + # Run daily at 7:37 |
| 11 | + - cron: '37 7 * * *' |
| 12 | + |
| 13 | +env: |
| 14 | + JOOMLA_MAJOR_VERSION: 6 |
| 15 | + JOOMLA_MINOR_VERSION: 6.0 |
| 16 | + |
| 17 | +permissions: |
| 18 | + contents: read |
| 19 | + |
| 20 | +jobs: |
| 21 | + build: |
| 22 | + permissions: |
| 23 | + contents: write # for Git to git push |
| 24 | + runs-on: ubuntu-latest |
| 25 | + # Only run this action the translation-bot repository in the relevant translation branch |
| 26 | + if: ${{ github.repository == 'joomla-translation-bot/joomla-cms' && github.ref == 'refs/heads/translation6' |
| 27 | + |
| 28 | + steps: |
| 29 | + - uses: actions/checkout@v3 |
| 30 | + # We need the full depth to create / update the pull request against the main repo |
| 31 | + with: |
| 32 | + ref: translation6 |
| 33 | + fetch-depth: 0 |
| 34 | + - uses: actions/setup-node@v3 |
| 35 | + with: |
| 36 | + node-version: 20 |
| 37 | + |
| 38 | + - name: Fetch latest cms changes |
| 39 | + run: | |
| 40 | + git config user.name Translation Bot |
| 41 | + git config user.email release+translation-bot@joomla.org |
| 42 | + git remote add upstream https://github.com/joomla/joomla-cms.git |
| 43 | + git fetch upstream |
| 44 | + git checkout --progress --force -B translation6 refs/remotes/origin/translation6 |
| 45 | + git merge upstream/${{ env.JOOMLA_MINOR_VERSION }}-dev |
| 46 | +
|
| 47 | + - name: Fetch and extract translations |
| 48 | + run: | |
| 49 | + cd .. |
| 50 | + wget -nv "https://github.com/joomla/core-translations/archive/refs/heads/main.zip" |
| 51 | + unzip main.zip |
| 52 | +
|
| 53 | + - name: Syncing directories |
| 54 | + # We use a simple copy paste syntax here if needed customization for different directories |
| 55 | + run: | |
| 56 | + cd .. |
| 57 | + SYNC_PATH="installation/language/" |
| 58 | + echo ${SYNC_PATH} |
| 59 | + rsync -i -rptgo --checksum --ignore-times --delete --exclude="*en-GB*" core-translations-main/joomla_v${{ env.JOOMLA_MAJOR_VERSION }}/translations/core/${SYNC_PATH} joomla-cms/${SYNC_PATH} |
| 60 | +
|
| 61 | + - name: Update static error pages |
| 62 | + run: | |
| 63 | + npm ci --ignore-scripts && node build/build.mjs --build-pages |
| 64 | +
|
| 65 | + - name: Create commit |
| 66 | + continue-on-error: true |
| 67 | + run: | |
| 68 | + git config user.name Translation Bot |
| 69 | + git config user.email release+translation-bot@joomla.org |
| 70 | + git add . |
| 71 | + git commit -m "Language update" |
| 72 | + git push --force |
| 73 | +
|
| 74 | + - name: Create pull request |
| 75 | + if: ${{ success() }} |
| 76 | + env: |
| 77 | + GITHUB_TOKEN: ${{ secrets.API_TOKEN_GITHUB }} |
| 78 | + run: | |
| 79 | + gh pr list -R joomla/joomla-cms --state open --author joomla-translation-bot -S "[${{ env.JOOMLA_MINOR_VERSION }}] Translation Update" --base ${{ env.JOOMLA_MINOR_VERSION }}-dev | grep -v "No pull" || \ |
| 80 | + gh pr create --title "[${{ env.JOOMLA_MINOR_VERSION }}] Translation Update" --body "Automatically created pull request based on core-translation repository changes" -R joomla/joomla-cms --base ${{ env.JOOMLA_MINOR_VERSION }}-dev |
0 commit comments