Skip to content

Commit 05b6a25

Browse files
committed
remove duplicates and comment out cleaning
1 parent 9bfb76a commit 05b6a25

File tree

2 files changed

+45
-161
lines changed

2 files changed

+45
-161
lines changed

.github/workflows/build-preview.yml

Lines changed: 0 additions & 116 deletions
This file was deleted.

.github/workflows/pr-preview.yml

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -433,34 +433,34 @@ jobs:
433433
repo: context.repo.repo,
434434
body: comment
435435
});
436-
437-
cleanup-preview:
438-
runs-on: ubuntu-latest
439-
if: github.event.action == 'closed'
440-
steps:
441-
- name: Log in to GitHub Container Registry
442-
uses: docker/login-action@v3
443-
with:
444-
registry: ghcr.io
445-
username: ${{ github.actor }}
446-
password: ${{ secrets.GITHUB_TOKEN }}
447-
448-
- name: Delete PR container images
449-
run: |
450-
# Delete container images for this PR
451-
PR_NUMBER=${{ github.event.number }}
452-
REPO_LOWER=$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]')
453-
454-
# Get all tags for this PR and delete them
455-
for tag in $(curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
456-
"https://api.github.com/orgs/${{ github.repository_owner }}/packages/container/${REPO_LOWER}%2Fwrongsecrets-pr/versions" | \
457-
jq -r --arg pr "$PR_NUMBER" '.[] | select(.metadata.container.tags[]? | contains($pr)) | .id'); do
458-
459-
echo "Deleting container version: $tag"
460-
curl -X DELETE \
461-
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
462-
"https://api.github.com/orgs/${{ github.repository_owner }}/packages/container/${REPO_LOWER}%2Fwrongsecrets-pr/versions/$tag"
463-
done
436+
#only need to enable if you want to clean up resources on PR close:
437+
# cleanup-preview:
438+
# runs-on: ubuntu-latest
439+
# if: github.event.action == 'closed'
440+
# steps:
441+
# - name: Log in to GitHub Container Registry
442+
# uses: docker/login-action@v3
443+
# with:
444+
# registry: ghcr.io
445+
# username: ${{ github.actor }}
446+
# password: ${{ secrets.GITHUB_TOKEN }}
447+
448+
# - name: Delete PR container images
449+
# run: |
450+
# # Delete container images for this PR
451+
# PR_NUMBER=${{ github.event.number }}
452+
# REPO_LOWER=$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]')
453+
454+
# # Get all tags for this PR and delete them
455+
# for tag in $(curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
456+
# "https://api.github.com/orgs/${{ github.repository_owner }}/packages/container/${REPO_LOWER}%2Fwrongsecrets-pr/versions" | \
457+
# jq -r --arg pr "$PR_NUMBER" '.[] | select(.metadata.container.tags[]? | contains($pr)) | .id'); do
458+
459+
# echo "Deleting container version: $tag"
460+
# curl -X DELETE \
461+
# -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
462+
# "https://api.github.com/orgs/${{ github.repository_owner }}/packages/container/${REPO_LOWER}%2Fwrongsecrets-pr/versions/$tag"
463+
# done
464464

465465
# Comment out Render cleanup for now
466466
# - name: Cleanup Render service
@@ -477,24 +477,24 @@ jobs:
477477
# -H "Authorization: Bearer $RENDER_API_KEY"
478478
# fi
479479

480-
- name: Comment PR closure
481-
uses: actions/github-script@v7
482-
with:
483-
script: |
484-
const comment = `🧹 **Preview Cleanup Complete**
480+
# - name: Comment PR closure
481+
# uses: actions/github-script@v7
482+
# with:
483+
# script: |
484+
# const comment = `🧹 **Preview Cleanup Complete**
485485

486-
PR preview resources have been cleaned up:
487-
- ✅ Container images deleted from GitHub Container Registry
488-
- ✅ Artifacts will expire automatically in 30 days
486+
# PR preview resources have been cleaned up:
487+
# - ✅ Container images deleted from GitHub Container Registry
488+
# - ✅ Artifacts will expire automatically in 30 days
489489

490-
Thanks for contributing to WrongSecrets! 🎉
490+
# Thanks for contributing to WrongSecrets! 🎉
491491

492-
---
493-
<sub>Cleanup completed by GitHub Actions</sub>`;
492+
# ---
493+
# <sub>Cleanup completed by GitHub Actions</sub>`;
494494

495-
github.rest.issues.createComment({
496-
issue_number: context.issue.number,
497-
owner: context.repo.owner,
498-
repo: context.repo.repo,
499-
body: comment
500-
});
495+
# github.rest.issues.createComment({
496+
# issue_number: context.issue.number,
497+
# owner: context.repo.owner,
498+
# repo: context.repo.repo,
499+
# body: comment
500+
# });

0 commit comments

Comments
 (0)