-
Notifications
You must be signed in to change notification settings - Fork 1.1k
61 lines (54 loc) · 1.89 KB
/
clean-envs.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
name: Clean environments
on:
schedule:
- cron: "0 0 * * 0"
workflow_dispatch:
branches: ["main"]
jobs:
cleanEnvironments:
runs-on: ubuntu-latest
env:
TOKEN: ${{ secrets.CLOUD_ACCESS_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version-file: ".nvmrc"
- name: Install dependencies
run: |
cd .github/workflows
npm ci
- name: clean release environments
id: clean-environments
run: |
node .github/workflows/cleanEnvironments.js \
--token "$TOKEN" \
--environments_to_clean_regex "^v\d+.staging"
- name: clean master environment
id: clean-master-environment
run: |
node .github/workflows/cleanEnvironments.js \
--token "$TOKEN" \
--environments_to_clean_regex "master.staging.saleor.cloud"
- name: Notify Slack
if: steps.clean-environments.outputs.sendWarningOnSlack == 'true'
env:
JOB_DEPLOYMENT_KIND: "release and master envs"
JOB_STATUS: 'failure'
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_SALEOR_QA_WEBHOOK_URL }}
JOB_TITLE: ${{ steps.clean-environments.outputs.warningMessage }}
JOB_KIND: "Clean Environments"
run: |
python3 .github/workflows/notify/notify-slack.py
- name: Notify Slack on qa-private
if: steps.clean-environments.outputs.sendWarningOnSlack == 'true'
env:
JOB_DEPLOYMENT_KIND: "release and master envs"
JOB_STATUS: 'failure'
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_SALEOR_QA_PRIVATE_WEBHOOK_URL }}
JOB_TITLE: ${{ steps.clean-environments.outputs.warningMessage }}
JOB_KIND: "Clean Environments"
run: |
python3 .github/workflows/notify/notify-slack.py