name: Delete old workflow runs on: schedule: - cron: '0 0 * * *' jobs: del_runs: runs-on: ubuntu-latest if: github.event.repository.fork == false permissions: actions: write contents: read id-token: write steps: - name: Delete workflow runs uses: Mattraks/delete-workflow-runs@v2 with: token: ${{ github.token }} repository: ${{ github.repository }} retain_days: 30 keep_minimum_runs: 6 # Points to a recent commit instead of `main` to avoid supply chain attacks. (The latest tag is very old.) - name: 🎟 Get GitHub App token uses: actions/create-github-app-token@v1 id: get-token with: app-id: ${{ secrets.GH_APP_ID }} private-key: ${{ secrets.GH_APP_PRIVATE_KEY }} - name: Delete workflow runs for current repo uses: Mattraks/delete-workflow-runs@v2 with: token: ${{ github.token }} repository: ${{ github.repository }} retain_days: 7 keep_minimum_runs: 6 - name: Delete deployment uses: strumwolf/delete-deployment-environment@v2.3.0 with: token: ${{ steps.get-token.outputs.token }} environment: Preview onlyRemoveDeployments: true - name: Delete MAIN deployment uses: strumwolf/delete-deployment-environment@v2.3.0 with: token: ${{ steps.get-token.outputs.token }} environment: Production onlyRemoveDeployments: true