-
Notifications
You must be signed in to change notification settings - Fork 455
44 lines (40 loc) · 1.22 KB
/
deploy-pr-close.yml
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
name: Deploy-PullRequestClose
on:
issue_comment:
types: [created]
env:
SERVICE_NAME: ks-console-actions-pr-${{ github.event.issue.number }}
jobs:
delete-check:
runs-on: ubuntu-latest
steps:
- name: acknowledge deployment request to commenter
id: check
uses: khan/pull-request-comment-trigger@master
with:
trigger: "/clear"
reaction: rocket
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
outputs:
triggered: ${{ steps.check.outputs.triggered }}
delete-workload:
if: needs.delete-check.outputs.triggered == 'true'
runs-on: ubuntu-latest
needs: delete-check
steps:
- name: executing remote ssh commands
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.QING_EIP }}
username: root
password: ${{ secrets.QING_PASSWORD }}
port: 22
script: |
kubectl -n kubesphere-system delete deploy,svc ${{ env.SERVICE_NAME }} || exit 0
- name: Create comment
uses: peter-evans/create-or-update-comment@v1
with:
issue-number: ${{ github.event.issue.number }}
body: |
Congratulations! Deployment cleaned.