Clean environments #67
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |