Skip to content

Purge old deployment environments #459

Purge old deployment environments

Purge old deployment environments #459

name: Purge old deployment environments
# **What it does**:
# Deletes old deployment environments. A deployment environment exists
# for the sake of a Azure Preview environment. Those Azure Preview environments
# and cleaned up by a separate process.
# **Why we have it**: To keep things neat and tidy.
# **Who does it impact**: Docs engineering.
on:
workflow_dispatch:
schedule:
- cron: '20 */3 * * *' # Run every 3 hours at 20 minutes past the hour
permissions:
contents: write
jobs:
purge-old-deployment-environments:
if: ${{ github.repository == 'github/docs-internal' || github.repository == 'github/docs' }}
runs-on: ubuntu-latest
steps:
- name: Checkout out repo
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
- uses: ./.github/actions/node-npm-setup
- name: Run purge script
if: ${{ env.FREEZE != 'true' }}
env:
GITHUB_REPOSITORY: ${{ github.repository }}
# Necessary to be able to delete deployment environments
GITHUB_TOKEN: ${{ secrets.DOCS_BOT_PAT_WORKFLOW_READORG }}
run: .github/actions-scripts/purge-old-deployment-environments.js
- name: Send Slack notification if workflow fails
uses: someimportantcompany/github-actions-slack-message@1d367080235edfa53df415bd8e0bbab480f29bad
if: ${{ failure() && env.FREEZE != 'true' }}
with:
channel: ${{ secrets.DOCS_ALERTS_SLACK_CHANNEL_ID }}
bot-token: ${{ secrets.SLACK_DOCS_BOT_TOKEN }}
color: failure
text: The last "Purge old deployment environments" run for ${{github.repository}} failed. See https://github.com/${{github.repository}}/actions/workflows/purge-old-deployment-environments.yml