Skip to content

Commit

Permalink
way better validation
Browse files Browse the repository at this point in the history
  • Loading branch information
CoderDake committed Aug 24, 2023
1 parent 4c476aa commit 71a0f0b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/daily-dev-bump.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -136,15 +136,15 @@ jobs:
- name: Clean up branches
run: |
set -x
# Get 5 most recent branches of closed DartDevtoolWorkflowBot PRs.
# Get list of refs(branches) that exist on the remote
# Get list of refs(branches) that exist on the remote, then filter for the auto-bump branches
EXISTING_BRANCHES=$(git ls-remote --heads | grep refs/heads/auto-bump- | sed 's|.*\(auto-bump-[[:digit:]]*\).*|\1|')
for EXISTING_BRANCH in $EXISTING_BRANCHES; do
IS_CLOSED=$(gh pr view --json closed --jq '.closed' "$EXISTING_BRANCH")
if [ "$IS_CLOSED" == "true" ] ; then
PR_IS_CLOSED=$(gh pr view --json closed --jq '.closed' "$EXISTING_BRANCH")
PR_AUTHOR=$(gh pr view --json author --jq '.author.login' "$EXISTING_BRANCH")
if [ "$PR_IS_CLOSED" == "true" && "$PR_AUTHOR" == "DartDevtoolWorkflowBot"] ; then
# If the branch exists and the PR is closed we will delete it
echo "gh api /repos/flutter/devtools/git/refs/heads/$EXISTING_BRANCH -X DELETE"
gh api /repos/flutter/devtools/git/refs/heads/$EXISTING_BRANCH -X DELETE
fi
done
env:
Expand Down

0 comments on commit 71a0f0b

Please sign in to comment.