-
Notifications
You must be signed in to change notification settings - Fork 59.8k
35 lines (28 loc) · 1.13 KB
/
purge-old-workflow-runs.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
name: Purge old workflow runs
# **What it does**: Deletes really old workflow runs.
# **Why we have it**: To keep things neat and tidy.
# **Who does it impact**: Docs engineering.
on:
workflow_dispatch:
schedule:
- cron: '20 */2 * * *' # Run every 2 hours at 20 minutes past the hour
permissions:
contents: write
jobs:
purge-old-workflow-runs:
if: ${{ github.repository == 'github/docs-internal' || github.repository == 'github/docs' }}
runs-on: ubuntu-latest
steps:
- name: Checkout out repo
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: ./.github/actions/node-npm-setup
- name: Run purge script
env:
# Necessary to be able to delete deployment environments
GITHUB_TOKEN: ${{ secrets.DOCS_BOT_PAT_WORKFLOW_READORG }}
run: src/workflows/purge-old-workflow-runs.js
- uses: ./.github/actions/slack-alert
if: ${{ failure() && github.event_name != 'workflow_dispatch' }}
with:
slack_channel_id: ${{ secrets.DOCS_ALERTS_SLACK_CHANNEL_ID }}
slack_token: ${{ secrets.SLACK_DOCS_BOT_TOKEN }}