name: Branch Cleanup on: workflow_call: jobs: branch-cleanup: runs-on: ubuntu-latest if: gitea.event.pull_request.merged == true steps: - name: Delete merged branch env: GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }} run: | BRANCH="${{ gitea.event.pull_request.head.ref }}" if [[ "$BRANCH" == "main" || "$BRANCH" == "master" || "$BRANCH" == "develop" ]]; then echo "Branch protetto, skip: $BRANCH" exit 0 fi curl -s -X DELETE \ -H "Authorization: token $GITEA_TOKEN" \ "https://gitea.pzetatouch.it/api/v1/repos/${{ gitea.repository }}/branches/$(python3 -c "import urllib.parse; print(urllib.parse.quote('$BRANCH', safe=''))")" echo "Branch eliminato: $BRANCH"