This repository has been archived by the owner on Sep 26, 2024. It is now read-only.
Delete Translation #2258
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: Delete Translation | |
permissions: | |
actions: write | |
checks: write | |
contents: write | |
deployments: write | |
pull-requests: write | |
statuses: write | |
on: | |
workflow_run: | |
workflows: ["Pre-delete Translation"] | |
types: | |
- completed | |
env: | |
BRANCH: ${{ github.event.workflow_run.head_branch }} | |
jobs: | |
delete-translation: | |
if: | | |
(startsWith(github.event.workflow_run.head_branch, 'translation') || startsWith(github.event.workflow_run.head_branch, 'stp')) && | |
!contains(github.event.workflow_run.head_branch, '!') && | |
!contains(github.event.workflow_run.head_branch, '@') && | |
!contains(github.event.workflow_run.head_branch, '#') && | |
!contains(github.event.workflow_run.head_branch, '$') && | |
!contains(github.event.workflow_run.head_branch, '%') && | |
!contains(github.event.workflow_run.head_branch, '^') && | |
!contains(github.event.workflow_run.head_branch, '&') && | |
!contains(github.event.workflow_run.head_branch, '*') && | |
!contains(github.event.workflow_run.head_branch, '(') && | |
!contains(github.event.workflow_run.head_branch, ')') | |
runs-on: ubuntu-latest | |
steps: | |
- name: 'Branch [${{ github.event.workflow_run.head_branch }}]' | |
run: | | |
CLEAN_BRANCH="${BRANCH//[^[:alnum:]-_]/}" | |
echo "Deleting Translation Branch $CLEAN_BRANCH" | |
- name: Checkout 🛎️ | |
uses: actions/[email protected] | |
with: | |
fetch-depth: 0 | |
ref: ${{ github.event.workflow_run.head_branch }} | |
repository: ${{github.event.workflow_run.head_repository.full_name}} | |
- name: Setup Node | |
uses: actions/[email protected] | |
with: | |
node-version: '18.x' | |
- name: Installing Crowdin | |
run: npm i -g @crowdin/[email protected] | |
- name: Delete Branch [${{ github.event.workflow_run.head_branch }}] 🗑️ | |
run: | | |
CLEAN_BRANCH="${BRANCH//[^[:alnum:]-_]/}" | |
crowdin branch delete $CLEAN_BRANCH -T ${{ secrets.CROWDIN_API_KEY }} | |