mirror of
https://github.com/netfun2000/hipudding-teslamate.git
synced 2026-02-27 09:44:28 +08:00
47 lines
1.4 KiB
YAML
47 lines
1.4 KiB
YAML
name: Purge PR images
|
|
|
|
on:
|
|
workflow_call:
|
|
pull_request_target:
|
|
types:
|
|
- closed
|
|
paths:
|
|
- "**/*"
|
|
- "!.github/**" # Important: Exclude PRs related to .github from auto-run
|
|
- "!.github/workflows/**" # Important: Exclude PRs related to .github/workflows from auto-run
|
|
- "!.github/actions/**" # Important: Exclude PRs related to .github/actions from auto-run
|
|
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
|
|
jobs:
|
|
check_paths:
|
|
uses: ./.github/workflows/check_paths.yml
|
|
|
|
purge-pr-package:
|
|
name: Delete images from ghcr.io when PR is closed
|
|
needs: check_paths
|
|
if: needs.check_paths.outputs.githubfolder != 'true'
|
|
runs-on: ubuntu-24.04
|
|
|
|
steps:
|
|
- uses: chipkent/action-cleanup-package@1316a66015b82d745b57acbb6c570f2bb1d108f9 # v1.0.3
|
|
id: cleanup
|
|
continue-on-error: true
|
|
with:
|
|
package-name: ${{ github.event.repository.name }}
|
|
tag: pr-${{ github.event.pull_request.number }}
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- uses: actions/delete-package-versions@e5bc658cc4c965c472efe991f8beea3981499c55 # v5.0.0
|
|
if: job.steps.cleanup.status == success()
|
|
name: Delete untagged images from ghcr.io
|
|
continue-on-error: true
|
|
with:
|
|
package-name: "teslamate"
|
|
package-type: "container"
|
|
min-versions-to-keep: 0
|
|
delete-only-untagged-versions: "true"
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|