saleor-dashboard/.github/workflows/clean-envs.yml
Karolina Rakoczy 5669b748d2
Clean environment db (#4112)
* clean environment db

* fix revert to snapshot

* Working workflow for cleaning environments

* clean also automation-dashboard

* Update .github/workflows/clean-envs.yml

Co-authored-by: Mikail <6186720+NyanKiyoshi@users.noreply.github.com>

* Update .github/workflows/cleanEnvironments.js

Co-authored-by: Mikail <6186720+NyanKiyoshi@users.noreply.github.com>

* fix workflow

---------

Co-authored-by: Mikail <6186720+NyanKiyoshi@users.noreply.github.com>
2023-08-23 14:19:16 +02:00

61 lines
No EOL
1.9 KiB
YAML

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