Skip to content

Commit b76e933

Browse files
zimegmwbrooks
andauthored
ci: attempt deletion of branch prereleases from prior versions on merge (#30)
Co-authored-by: Michael Brooks <[email protected]>
1 parent cf5fcb1 commit b76e933

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

.github/workflows/delete-pr-build-on-close.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,21 @@ jobs:
1919
run: |
2020
# Figure out tag name from branch name. This is coupled to the tag name generation that exists in .circleci/config.yml's `create-github-release` job.
2121
RELEASES=$(gh release list --repo="slackapi/slack-cli" --order="desc" --json="tagName" --exclude-drafts --exclude-pre-releases --limit=24 --jq ".[] | .tagName")
22+
RELEASE_FOUND=1
2223
for TAGS in $RELEASES; do
2324
TAG_NAME="${TAGS}-${{ github.event.ref }}"
2425
echo "Identified pre-release tagname to 🔪: $TAG_NAME"
2526
2627
# Delete the pre-release
2728
if GH_DEBUG=1 gh release --repo="slackapi/slack-cli" delete "$TAG_NAME" -y --cleanup-tag; then
2829
echo "Successfully deleted $TAG_NAME"
29-
exit 0
30+
RELEASE_FOUND=0
3031
else
3132
echo "Failed to find $TAG_NAME, trying next..."
3233
fi
34+
sleep 1
3335
done
34-
echo "No matching pre-releases tag was found for the branch $TAG_NAME in recent versions"
35-
exit 1
36+
if [ "$RELEASE_FOUND" -ne 0 ]; then
37+
echo "No matching pre-releases tag was found for the branch $TAG_NAME in recent versions"
38+
fi
39+
exit "$RELEASE_FOUND"

0 commit comments

Comments
 (0)