Delete Translation #8
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/checkout@v2.3.1 | |
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/setup-node@v2.1.2 | |
with: | |
node-version: '18.x' | |
- name: Installing Crowdin | |
run: npm i -g @crowdin/cli@3.7.8 | |
- name: Delete Branch [${{ github.event.workflow_run.head_branch }}] 🗑️ | |
run: | | |
CLEAN_BRANCH="${BRANCH//[^[:alnum:]-_]/}" | |
crowdin branch delete $CLEAN_BRANCH -T ${{ secrets.CROWDIN_API_KEY }} | |