spec update cleanup #390
This file contains hidden or 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: spec update cleanup | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| service: | |
| description: 'Which service the branch was created for' | |
| type: choice | |
| required: true | |
| options: | |
| - ai-api | |
| - document-grounding | |
| - orchestration | |
| - prompt-registry | |
| - sap-rpt | |
| default: orchestration | |
| ref: | |
| description: 'Original branch or tag the branch was created from' | |
| required: false | |
| default: main | |
| type: string | |
| workflow_call: | |
| inputs: | |
| service: | |
| description: 'Which service the branch was created for' | |
| required: true | |
| type: string | |
| ref: | |
| description: 'Original branch or tag the branch was created from' | |
| required: false | |
| default: main | |
| type: string | |
| jobs: | |
| cleanup: | |
| name: 'Delete Spec Update Branch' | |
| runs-on: [ubuntu-latest] | |
| permissions: | |
| contents: write | |
| env: | |
| SERVICE: ${{ inputs.service }} | |
| REF: ${{ inputs.ref }} | |
| steps: | |
| - name: 'Delete Branch' | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| BRANCH="spec-update/$SERVICE/$REF" | |
| if git ls-remote --exit-code --heads https://github.com/SAP/ai-sdk-java.git "$BRANCH" > /dev/null 2>&1; then | |
| gh api "repos/SAP/ai-sdk-java/git/refs/heads/$BRANCH" -X DELETE | |
| echo "Deleted branch: $BRANCH" | |
| else | |
| echo "Branch $BRANCH does not exist, nothing to delete." | |
| fi |