Delete old workflow runs #640
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: Delete old workflow runs | |
on: | |
workflow_dispatch: | |
inputs: | |
seconds: | |
description: 'Number of seconds' | |
required: true | |
default: 604800 | |
schedule: | |
- cron: '53 3 * * *' | |
env: | |
SLACK_NOTIFY: false | |
jobs: | |
delete-old-workflows: | |
name: Delete old workflow runs | |
runs-on: ubuntu-latest | |
permissions: | |
actions: write | |
steps: | |
- name: Set the variables | |
env: | |
DEFAULT_SECONDS: 604800 | |
run: | | |
echo "SECONDS=${{ github.event.inputs.seconds || env.DEFAULT_SECONDS }}" >> "${GITHUB_ENV}" | |
- name: Delete workflow runs | |
uses: MajorScruffy/delete-old-workflow-runs@78b5af714fefaefdf74862181c467b061782719e # v0.2.0 | |
with: | |
repository: ${{ github.repository }} | |
older-than-seconds: ${{ env.SECONDS }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
slack-workflow-status: | |
if: success() || failure() | |
name: Slack Post Workflow Notification | |
needs: | |
- delete-old-workflows | |
runs-on: ubuntu-latest | |
steps: | |
- name: Slack Workflow Notifications | |
if: ${{ env.SLACK_NOTIFY == 'true' && github.event_name == 'push' }} | |
uses: Gamesight/slack-workflow-status@68bf00d0dbdbcb206c278399aa1ef6c14f74347a # v1.3.0 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
slack_webhook_url: ${{ secrets.SLACK_WEBHOOK_URL }} | |
include_jobs: on-failure | |
include_commit_message: true |