diff --git a/.github/workflows/container-prune.yaml b/.github/workflows/container-prune.yaml new file mode 100644 index 0000000000..0baff4174f --- /dev/null +++ b/.github/workflows/container-prune.yaml @@ -0,0 +1,30 @@ +name: Container Image Cleanup + +on: + workflow_run: + workflows: ["Nighly Docker Build"] + types: [completed] + workflow_dispatch: + + +jobs: + prune: + name: Prune Container Images + runs-on: ubuntu-latest + steps: + - uses: bots-house/ghcr-delete-image-action@v1.1.0 + with: + owner: spectrocloud + name: librarium + token: ${{ secrets.GITHUB_TOKEN }} + untagged-keep-latest: 2 + + - name: Slack Notification + if: ${{ failure() }} + uses: rtCamp/action-slack-notify@v2 + env: + SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} + SLACK_USERNAME: "spectromate" + SLACK_ICON_EMOJI: ":robot_panic:" + SLACK_COLOR: ${{ job.status }} + SLACK_MESSAGE: 'The nightly docs container prune workflow failed. Review the GitHub Actions logs for more details.'