-
Notifications
You must be signed in to change notification settings - Fork 42
41 lines (37 loc) · 1.31 KB
/
delete-staging.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
name: Delete the staging environment
on:
pull_request_target:
types:
- closed
repository_dispatch:
types:
- undeploy-staging-command
jobs:
dispatch-deletion-request:
name: Dispatch the deletion request
runs-on: ubuntu-latest
steps:
- name: Get the PR number
id: pr-number
run: |
[[ "${{ github.event_name }}" == "pull_request_target" ]] && \
echo "number=${{ github.event.pull_request.number }}" >> $GITHUB_OUTPUT || \
echo "number=${{ github.event.client_payload.github.payload.issue.number }}" >> $GITHUB_OUTPUT
- name: Notify Event to CrownOps
uses: peter-evans/repository-dispatch@v2
with:
token: ${{ secrets.CI_TOKEN }}
repository: netgroup-polito/CrownOps
event-type: undeploy-staging-event
client-payload: |
{
"repository": "${{ github.repository }}",
"pr-number": "${{ steps.pr-number.outputs.number }}"
}
- name: Report status as reaction
uses: peter-evans/create-or-update-comment@v2
with:
token: ${{ secrets.CI_TOKEN }}
comment-id: ${{ github.event.client_payload.github.payload.comment.id }}
reactions: 'hooray'
if: github.event_name == 'repository_dispatch'