forked from SAP/ai-sdk-java
-
Notifications
You must be signed in to change notification settings - Fork 0
55 lines (53 loc) · 1.49 KB
/
spec-update-cleanup.yaml
File metadata and controls
55 lines (53 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
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'
needs: [auth]
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