File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed
Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -4,8 +4,9 @@ name: Delete pre-release when a branch is deleted
44# The circleci config builds CLI binaries when a PR is opened and hosts them under a GitHub (pre-)release named after the PR branch
55# This workflow action deletes that pre-release when a PR is merged or closed.
66on :
7- delete :
8- branches :
7+ pull_request :
8+ types :
9+ - closed
910
1011jobs :
1112 delete-pre-release :
1718 GH_TOKEN : ${{ github.token }}
1819 shell : bash
1920 run : |
21+ # Use either an upstream or fork PR branch
22+ if [[ "${{ github.event.pull_request.head.repo.full_name }}" != "${{ github.repository }}" ]]; then
23+ BRANCH="pull/${{ github.event.pull_request.number }}/head"
24+ else
25+ BRANCH="${{ github.event.pull_request.head.ref }}"
26+ fi
27+
2028 # Escape tags to create a semantic version
21- REF=$(echo "${{ github.event.ref } }" | sed 's/\//-/g')
29+ REF=$(echo "${BRANCH }" | sed 's/\//-/g')
2230 RELEASE_FOUND=1
2331
2432 # Delete tags matching the pull request branch from forks
You can’t perform that action at this time.
0 commit comments