mirror of
https://github.com/Mintplex-Labs/anything-llm
synced 2026-04-25 17:15:37 +02:00
patch attempt for GH cleanup tag
This commit is contained in:
30
.github/workflows/cleanup-qa-tag.yaml
vendored
30
.github/workflows/cleanup-qa-tag.yaml
vendored
@@ -10,17 +10,27 @@ jobs:
|
||||
name: Delete QA GHCR image tag
|
||||
runs-on: ubuntu-latest
|
||||
if: >-
|
||||
${{ (github.event.action == 'closed' && contains(github.event.pull_request.labels.*.name, 'PR: Ready for QA')) ||
|
||||
(github.event.action == 'unlabeled' && github.event.label.name == 'PR: Ready for QA') }}
|
||||
(github.event.action == 'closed' && contains(github.event.pull_request.labels.*.name, 'PR: Ready for QA')) ||
|
||||
(github.event.action == 'unlabeled' && github.event.label.name == 'PR: Ready for QA')
|
||||
permissions:
|
||||
packages: write
|
||||
steps:
|
||||
- name: Delete PR tag from GHCR
|
||||
uses: actions/delete-package-versions@v5
|
||||
continue-on-error: true # Package may not exist if build never ran
|
||||
with:
|
||||
owner: ${{ github.repository_owner }}
|
||||
package-name: ${{ github.event.repository.name }}
|
||||
package-type: container
|
||||
min-versions-to-keep: 0
|
||||
ignore-versions: '^(?!pr-${{ github.event.pull_request.number }}$).*$'
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
VERSION_ID=$(gh api \
|
||||
-H "Accept: application/vnd.github+json" \
|
||||
"/orgs/${{ github.repository_owner }}/packages/container/${{ github.event.repository.name }}/versions" \
|
||||
--jq '.[] | select(.metadata.container.tags[] == "pr-${{ github.event.pull_request.number }}") | .id' \
|
||||
2>/dev/null || true)
|
||||
|
||||
if [ -n "$VERSION_ID" ]; then
|
||||
echo "Deleting package version $VERSION_ID (tag: pr-${{ github.event.pull_request.number }})"
|
||||
gh api \
|
||||
--method DELETE \
|
||||
-H "Accept: application/vnd.github+json" \
|
||||
"/orgs/${{ github.repository_owner }}/packages/container/${{ github.event.repository.name }}/versions/$VERSION_ID"
|
||||
else
|
||||
echo "No package found with tag pr-${{ github.event.pull_request.number }}, skipping cleanup"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user