digitalocean_gc.yml 1.5 KB

123456789101112131415161718192021222324252627282930313233343536
  1. name: DigitalOcean
  2. on:
  3. workflow_dispatch:
  4. workflow_call:
  5. jobs:
  6. garbage-collection:
  7. runs-on: ubuntu-latest
  8. permissions:
  9. contents: read
  10. steps:
  11. - name: Install doctl
  12. uses: digitalocean/action-doctl@5727c67aa3c2c34ae9462d5a0ecfea8a1b31e5ce # v2
  13. with:
  14. token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
  15. - name: Run garbage collection
  16. run: |
  17. # --force: Required for CI to skip confirmation prompts
  18. # --include-untagged-manifests: Deletes unreferenced manifests to maximize space
  19. doctl registry garbage-collection start --force --include-untagged-manifests
  20. - name: Send email on failure
  21. uses: dawidd6/action-send-mail@2cea9617b09d79a095af21254fbcb7ae95903dde # v3.12.0
  22. if: ${{ failure() }}
  23. with:
  24. server_address: smtp.mailgun.org
  25. server_port: 465
  26. username: ${{ secrets.SMTP_USERNAME }}
  27. password: ${{ secrets.SMTP_PASSWORD }}
  28. subject: GitHub Actions (${{ github.repository }}) job result
  29. to: github-actions-8ce6454@unknwon.io
  30. from: GitHub Actions (${{ github.repository }})
  31. reply_to: noreply@unknwon.io
  32. body: |
  33. The job "${{ github.job }}" of ${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }} completed with "${{ job.status }}".
  34. View the job run at: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}