Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions .github/workflows/delete-pr-build-on-close.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,21 @@ jobs:
run: |
# 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.
RELEASES=$(gh release list --repo="slackapi/slack-cli" --order="desc" --json="tagName" --exclude-drafts --exclude-pre-releases --limit=24 --jq ".[] | .tagName")
RELEASE_FOUND=1
for TAGS in $RELEASES; do
TAG_NAME="${TAGS}-${{ github.event.ref }}"
echo "Identified pre-release tagname to 🔪: $TAG_NAME"

# Delete the pre-release
if GH_DEBUG=1 gh release --repo="slackapi/slack-cli" delete "$TAG_NAME" -y --cleanup-tag; then
echo "Successfully deleted $TAG_NAME"
exit 0
RELEASE_FOUND=0
else
echo "Failed to find $TAG_NAME, trying next..."
fi
sleep 1
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😴 Rest is so important and I hope this helps us avoid rate limits of rapid loops!
https://docs.github.com/en/rest/using-the-rest-api/rate-limits-for-the-rest-api?apiVersion=2022-11-28#about-secondary-rate-limits

done
echo "No matching pre-releases tag was found for the branch $TAG_NAME in recent versions"
exit 1
if [ "$RELEASE_FOUND" -ne 0 ]; then
echo "No matching pre-releases tag was found for the branch $TAG_NAME in recent versions"
fi
exit "$RELEASE_FOUND"
Loading