File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : PR Preview Cleanup Signal
2+
3+ on :
4+ pull_request :
5+ types : [closed]
6+
7+
8+ jobs :
9+ cleanup-signal :
10+ name : Signal Cleanup
11+ runs-on : ubuntu-latest
12+ permissions :
13+ contents : write
14+
15+ steps :
16+ - name : Save PR number for cleanup
17+ run : |
18+ mkdir -p ./cleanup
19+ echo ${{ github.event.pull_request.number }} > ./cleanup/number
20+
21+ - name : Upload cleanup signal
22+ uses : actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
23+ with :
24+ name : cleanup-signal
25+ path : cleanup/
Original file line number Diff line number Diff line change 11name : PR Preview Cleanup
22
33on :
4- pull_request :
5- types : [closed]
4+ workflow_run :
5+ workflows : ["PR Preview Cleanup Signal"]
6+ types :
7+ - completed
68
79permissions :
8- contents : write
10+ contents : write
11+ pull-requests : write
912
1013jobs :
11- cleanup :
12- name : Delete PR Release
13- runs-on : ubuntu-latest
14+ cleanup :
15+ name : Delete PR Release
16+ runs-on : ubuntu-latest
17+ if : ${{ github.event.workflow_run.conclusion == 'success' }}
1418
15- steps :
16- - name : Delete PR Release
17- env :
18- GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
19- RELEASE_TAG : ' agentapi_${{ github.event.pull_request.number }}'
20- run : |
21- gh release delete "$RELEASE_TAG" --cleanup-tag --yes --repo ${{ github.repository }} || true
19+ steps :
20+ - name : Download cleanup signal
21+ uses : actions/download-artifact@v4
22+ with :
23+ name : cleanup-signal
24+ github-token : ${{ secrets.GITHUB_TOKEN }}
25+ run-id : ${{ github.event.workflow_run.id }}
26+
27+ - name : Read PR number
28+ id : pr
29+ run : echo "number=$(cat number)" >> "${GITHUB_OUTPUT}"
30+
31+ - name : Delete PR Release
32+ env :
33+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
34+ RELEASE_TAG : " agentapi_${{ steps.pr.outputs.number }}"
35+ run : |
36+ # Check if release exists and delete it
37+ if gh release view "$RELEASE_TAG" --repo ${{ github.repository }} &>/dev/null; then
38+ echo "Deleting release $RELEASE_TAG"
39+ gh release delete "$RELEASE_TAG" --cleanup-tag --yes --repo ${{ github.repository }}
40+ else
41+ echo "Release $RELEASE_TAG does not exist, nothing to delete"
42+ fi
You can’t perform that action at this time.
0 commit comments