From 85ddcd17eb0a09d1e2665a064cf3e6f76ae073ef Mon Sep 17 00:00:00 2001 From: "Dylan T." Date: Sun, 19 Oct 2025 19:14:17 +0100 Subject: [PATCH] Trigger Crowdin upload via RestrictedActions --- .github/workflows/crowdin-upload-trigger.yml | 34 ++++++++++++++++++ .github/workflows/upload-translations.yml | 38 -------------------- 2 files changed, 34 insertions(+), 38 deletions(-) create mode 100644 .github/workflows/crowdin-upload-trigger.yml delete mode 100644 .github/workflows/upload-translations.yml diff --git a/.github/workflows/crowdin-upload-trigger.yml b/.github/workflows/crowdin-upload-trigger.yml new file mode 100644 index 000000000..4f6e39fae --- /dev/null +++ b/.github/workflows/crowdin-upload-trigger.yml @@ -0,0 +1,34 @@ +name: Upload translations to Crowdin + +on: + push: + paths: + - resources/translations/eng.ini + branches: + - stable + - minor-next + - major-next + workflow_dispatch: + +jobs: + upload: + name: Upload translations + runs-on: ubuntu-latest + + steps: + - name: Generate access token + id: generate-token + uses: actions/create-github-app-token@v2 + with: + app-id: ${{ vars.RESTRICTED_ACTIONS_DISPATCH_ID }} + private-key: ${{ secrets.RESTRICTED_ACTIONS_DISPATCH_KEY }} + owner: ${{ github.repository_owner }} + repositories: RestrictedActions + + - name: Dispatch restricted action + uses: peter-evans/repository-dispatch@v3 + with: + token: ${{ steps.generate-token.outputs.token }} + repository: ${{ github.repository_owner }}/RestrictedActions + event-type: pocketmine_mp_crowdin_upload + client-payload: '{"branch": "${{ github.ref_name }}"}' diff --git a/.github/workflows/upload-translations.yml b/.github/workflows/upload-translations.yml deleted file mode 100644 index 6c8a1a398..000000000 --- a/.github/workflows/upload-translations.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: Upload translations to Crowdin - -on: - push: - paths: - - resources/translations/eng.ini - branches: - - stable - - minor-next - - major-next - workflow_dispatch: - -jobs: - upload: - name: Upload translations - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v5 - - - name: Preprocess eng.ini placeholders so Crowdin can understand them - working-directory: resources/translations - run: | - sed -i -r 's/\{%([A-Za-z0-9]+)\}/\{\1\}/g' eng.ini - cat eng.ini - - - name: Upload eng.ini to Crowdin - uses: crowdin/github-action@v2 - with: - upload_sources: true - upload_translations: false - download_translations: false - create_pull_request: false - crowdin_branch_name: ${{ github.ref_name }} - env: - GITHUB_TOKEN: ${{ github.token }} - CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }} - CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}