8b292ae35d
- Aggiunti 6 workflow condivisi in .gitea/workflows/ con trigger workflow_call - Implementati: quality-gates, npm-publish, docker-release, auto-release, dependency-check, branch-cleanup - Aggiunti esempi consumer per microservizio e libreria-npm (ci, release, maintenance) - Allineato npm run lint:check su tutti i workflow - Corretti GITEA_TOKEN, gitea.* context, GITHUB_REF/GITHUB_OUTPUT per compatibilità Gitea - Rimosso needs: tra job reusable (Gitea bug #31900), path uses: con .gitea/workflows/ Fixes #1 @1d
27 lines
805 B
YAML
27 lines
805 B
YAML
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"
|