Skip to content

Commit e7e1f54

Browse files
Simon Emmsroboquat
authored andcommitted
[kots]: delete channel on branch delete
1 parent 4ef9f0d commit e7e1f54

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Branch Deleted
2+
on: delete
3+
env:
4+
REPLICATED_CLI_VERSION: 0.40.1
5+
REPLICATED_API_TOKEN: ${{ secrets.REPLICATED_API_TOKEN }}
6+
REPLICATED_APP: ${{ secrets.REPLICATED_APP }}
7+
jobs:
8+
delete:
9+
if: github.event.ref_type == 'branch'
10+
runs-on: ubuntu-latest
11+
continue-on-error: true
12+
steps:
13+
- name: Install Replicated CLI
14+
run: |
15+
curl -sL https://github.com/replicatedhq/replicated/releases/download/v${{ env.REPLICATED_CLI_VERSION }}/replicated_${{ env.REPLICATED_CLI_VERSION }}_linux_amd64.tar.gz -o replicated.tar.gz
16+
tar xf replicated.tar.gz replicated && rm replicated.tar.gz
17+
mv replicated /usr/local/bin/replicated
18+
19+
- name: Delete Replicated channel
20+
run: |
21+
CHANNEL_ID=$(replicated channel inspect ${{ github.event.ref }} \
22+
| grep "ID:" \
23+
| sed "s/ID://" \
24+
| sed "s/ //g" || true)
25+
26+
if [ "${CHANNEL_ID}" = "" ]; then
27+
echo "No channel found"
28+
exit 0
29+
fi
30+
31+
# Allowed to fail if customers on channel - this will need to be manually deleted
32+
replicated channel rm "${CHANNEL_ID}" || true

0 commit comments

Comments
 (0)