From 4bcea432c319900169967a4e81527444c0e252e0 Mon Sep 17 00:00:00 2001 From: Dan Chevalier Date: Thu, 24 Aug 2023 13:29:22 -0400 Subject: [PATCH 01/24] attempt to fix branch deletion --- .github/workflows/daily-dev-bump.yaml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/daily-dev-bump.yaml b/.github/workflows/daily-dev-bump.yaml index b261218423c..a108e577423 100644 --- a/.github/workflows/daily-dev-bump.yaml +++ b/.github/workflows/daily-dev-bump.yaml @@ -22,6 +22,8 @@ on: schedule: # * is a special character in YAML so you have to quote this string - cron: "0 8 * * *" # Run every day at midnight Pacific Time + label: + types: [created, deleted] permissions: contents: write pull-requests: write @@ -31,7 +33,7 @@ env: jobs: bump-version: - if: ${{ github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' }} + if: ${{ (github.event_name == 'workflow_dispatch' || github.event_name == 'schedule') && github.repository == 'flutter/devtools' }} name: Bump Version runs-on: ubuntu-latest steps: @@ -123,8 +125,8 @@ jobs: IS_DRAFT: ${{ inputs.draft == true }} clean-up-branches: # If a pr is closed on a workflow bot PR, then clean up workflow bot branches. - if: ${{ github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.user.login == 'DartDevtoolWorkflowBot'}} - name: Clean up Dev Bump Branches + if: ${{ github.event_name == 'label' || (github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.user.login == 'DartDevtoolWorkflowBot' && github.repository == 'flutter/devtools') }} + name: Clean up 5 Dev Bump Branches runs-on: ubuntu-latest steps: - name: Clean up branches @@ -140,3 +142,5 @@ jobs: gh api /repos/flutter/devtools/git/refs/heads/$CLOSED_BRANCH -X DELETE fi done + env: | + GH_TOKEN: ${{ secrets.DEVTOOLS_WORKFLOW_BOT_TOKEN }} From 266ebbe29e41dae802b82c2e764e49dc639842d4 Mon Sep 17 00:00:00 2001 From: Dan Chevalier Date: Thu, 24 Aug 2023 14:22:54 -0400 Subject: [PATCH 02/24] remove if for now --- .github/workflows/daily-dev-bump.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/daily-dev-bump.yaml b/.github/workflows/daily-dev-bump.yaml index a108e577423..1cf73e6fa00 100644 --- a/.github/workflows/daily-dev-bump.yaml +++ b/.github/workflows/daily-dev-bump.yaml @@ -125,7 +125,6 @@ jobs: IS_DRAFT: ${{ inputs.draft == true }} clean-up-branches: # If a pr is closed on a workflow bot PR, then clean up workflow bot branches. - if: ${{ github.event_name == 'label' || (github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.user.login == 'DartDevtoolWorkflowBot' && github.repository == 'flutter/devtools') }} name: Clean up 5 Dev Bump Branches runs-on: ubuntu-latest steps: From 716d86087ec6f348330d28e74ce72230414be566 Mon Sep 17 00:00:00 2001 From: Dan Chevalier Date: Thu, 24 Aug 2023 14:26:17 -0400 Subject: [PATCH 03/24] comment out bump job --- .github/workflows/daily-dev-bump.yaml | 182 +++++++++++++------------- 1 file changed, 91 insertions(+), 91 deletions(-) diff --git a/.github/workflows/daily-dev-bump.yaml b/.github/workflows/daily-dev-bump.yaml index 1cf73e6fa00..dcafa5c41e1 100644 --- a/.github/workflows/daily-dev-bump.yaml +++ b/.github/workflows/daily-dev-bump.yaml @@ -32,97 +32,97 @@ env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} jobs: - bump-version: - if: ${{ (github.event_name == 'workflow_dispatch' || github.event_name == 'schedule') && github.repository == 'flutter/devtools' }} - name: Bump Version - runs-on: ubuntu-latest - steps: - - name: git clone devtools - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 - with: - ref: master - - - uses: dart-lang/setup-dart@d6a63dab3335f427404425de0fbfed4686d93c4f - - - name: setup git config - run: | - - git config user.name "DevTools Workflow Bot" - git config user.email "dart-devtool-workflow-bot@google.com" - - - name: Bump the Version - id: version-bump - run: | - set -ex - pushd tool/ - dart pub get - popd - - ORIGINAL_VERSION=$(dart tool/update_version.dart current-version) - - if [ -z "$UPDATE_TYPE" ]; then - # If $UPDATE_TYPE is not set, then assume it is dev - UPDATE_TYPE="dev" - fi - - # If there is a major, minor, or patch bump, do it. - - if [ "$UPDATE_TYPE" == "patch+dev" ]; then - dart tool/update_version.dart auto --type patch - dart tool/update_version.dart auto --type dev - elif [ "$UPDATE_TYPE" == "minor+dev" ]; then - dart tool/update_version.dart auto --type minor - dart tool/update_version.dart auto --type dev - elif [ "$UPDATE_TYPE" == "major+dev" ]; then - dart tool/update_version.dart auto --type major - dart tool/update_version.dart auto --type dev - elif [ "$UPDATE_TYPE" == "dev" ]; then - if ! echo "$ORIGINAL_VERSION" | grep -Eq "\-dev\.[0-9]+" ; then - ERROR_DESCRIPTION="Doing \ - a Dev bump on a release version ($ORIGINAL_VERSION) is not supported. \ - Ensure that that current version has been properly bumped to a '-dev.*' \ - pre-release version, in order to continue daily dev bumps." - - echo "::error ,title=Cannot do a dev bump on a Release Version ($ORIGINAL_VERSION)::$ERROR_DESCRIPTION" - exit 1; - fi - dart tool/update_version.dart auto --type dev - else - echo "ERROR: UNEXPECTED UPDATE TYPE: $UPDATE_TYPE" - exit 1 - fi - - NEW_VERSION=$(dart tool/update_version.dart current-version) - - echo "COMMIT_MESSAGE=Updating from $ORIGINAL_VERSION to $NEW_VERSION" >> $GITHUB_OUTPUT - env: - UPDATE_TYPE: ${{ inputs.updateType }} - - - name: Create the PR - run: | - set -ex - BRANCH_NAME="auto-bump-$(date +%s)" - # Stage the file, commit and push - git checkout -b "$BRANCH_NAME" - git commit -a -m "$COMMIT_MESSAGE" - git push -u origin "$BRANCH_NAME" - - if [ "$IS_DRAFT" == "true" ]; then - CREATION_FLAGS="--draft" - fi - - PR_URL=$(gh pr create --title "$COMMIT_MESSAGE" --body "Automated Version Bump" $CREATION_FLAGS) - - # Change github credentials back to the actions bot. - GH_TOKEN="$ORIGINAL_GH_TOKEN" - - gh pr edit $PR_URL $FLAGS --add-label "autosubmit" - - env: - COMMIT_MESSAGE: ${{ steps.version-bump.outputs.COMMIT_MESSAGE }} - GH_TOKEN: ${{ secrets.DEVTOOLS_WORKFLOW_BOT_TOKEN }} - ORIGINAL_GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - IS_DRAFT: ${{ inputs.draft == true }} + # bump-version: + # if: ${{ (github.event_name == 'workflow_dispatch' || github.event_name == 'schedule') && github.repository == 'flutter/devtools' }} + # name: Bump Version + # runs-on: ubuntu-latest + # steps: + # - name: git clone devtools + # uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 + # with: + # ref: master + + # - uses: dart-lang/setup-dart@d6a63dab3335f427404425de0fbfed4686d93c4f + + # - name: setup git config + # run: | + + # git config user.name "DevTools Workflow Bot" + # git config user.email "dart-devtool-workflow-bot@google.com" + + # - name: Bump the Version + # id: version-bump + # run: | + # set -ex + # pushd tool/ + # dart pub get + # popd + + # ORIGINAL_VERSION=$(dart tool/update_version.dart current-version) + + # if [ -z "$UPDATE_TYPE" ]; then + # # If $UPDATE_TYPE is not set, then assume it is dev + # UPDATE_TYPE="dev" + # fi + + # # If there is a major, minor, or patch bump, do it. + + # if [ "$UPDATE_TYPE" == "patch+dev" ]; then + # dart tool/update_version.dart auto --type patch + # dart tool/update_version.dart auto --type dev + # elif [ "$UPDATE_TYPE" == "minor+dev" ]; then + # dart tool/update_version.dart auto --type minor + # dart tool/update_version.dart auto --type dev + # elif [ "$UPDATE_TYPE" == "major+dev" ]; then + # dart tool/update_version.dart auto --type major + # dart tool/update_version.dart auto --type dev + # elif [ "$UPDATE_TYPE" == "dev" ]; then + # if ! echo "$ORIGINAL_VERSION" | grep -Eq "\-dev\.[0-9]+" ; then + # ERROR_DESCRIPTION="Doing \ + # a Dev bump on a release version ($ORIGINAL_VERSION) is not supported. \ + # Ensure that that current version has been properly bumped to a '-dev.*' \ + # pre-release version, in order to continue daily dev bumps." + + # echo "::error ,title=Cannot do a dev bump on a Release Version ($ORIGINAL_VERSION)::$ERROR_DESCRIPTION" + # exit 1; + # fi + # dart tool/update_version.dart auto --type dev + # else + # echo "ERROR: UNEXPECTED UPDATE TYPE: $UPDATE_TYPE" + # exit 1 + # fi + + # NEW_VERSION=$(dart tool/update_version.dart current-version) + + # echo "COMMIT_MESSAGE=Updating from $ORIGINAL_VERSION to $NEW_VERSION" >> $GITHUB_OUTPUT + # env: + # UPDATE_TYPE: ${{ inputs.updateType }} + + # - name: Create the PR + # run: | + # set -ex + # BRANCH_NAME="auto-bump-$(date +%s)" + # # Stage the file, commit and push + # git checkout -b "$BRANCH_NAME" + # git commit -a -m "$COMMIT_MESSAGE" + # git push -u origin "$BRANCH_NAME" + + # if [ "$IS_DRAFT" == "true" ]; then + # CREATION_FLAGS="--draft" + # fi + + # PR_URL=$(gh pr create --title "$COMMIT_MESSAGE" --body "Automated Version Bump" $CREATION_FLAGS) + + # # Change github credentials back to the actions bot. + # GH_TOKEN="$ORIGINAL_GH_TOKEN" + + # gh pr edit $PR_URL $FLAGS --add-label "autosubmit" + + # env: + # COMMIT_MESSAGE: ${{ steps.version-bump.outputs.COMMIT_MESSAGE }} + # GH_TOKEN: ${{ secrets.DEVTOOLS_WORKFLOW_BOT_TOKEN }} + # ORIGINAL_GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # IS_DRAFT: ${{ inputs.draft == true }} clean-up-branches: # If a pr is closed on a workflow bot PR, then clean up workflow bot branches. name: Clean up 5 Dev Bump Branches From 8b8b96ac282856a8f728852bfcc72dea7abe95b6 Mon Sep 17 00:00:00 2001 From: Dan Chevalier Date: Thu, 24 Aug 2023 14:28:28 -0400 Subject: [PATCH 04/24] no pipe on env --- .github/workflows/daily-dev-bump.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/daily-dev-bump.yaml b/.github/workflows/daily-dev-bump.yaml index dcafa5c41e1..f7e099acbef 100644 --- a/.github/workflows/daily-dev-bump.yaml +++ b/.github/workflows/daily-dev-bump.yaml @@ -141,5 +141,5 @@ jobs: gh api /repos/flutter/devtools/git/refs/heads/$CLOSED_BRANCH -X DELETE fi done - env: | + env: GH_TOKEN: ${{ secrets.DEVTOOLS_WORKFLOW_BOT_TOKEN }} From 2e5229c81da654f0afa23686dd8c7b11fe887187 Mon Sep 17 00:00:00 2001 From: Dan Chevalier Date: Thu, 24 Aug 2023 14:36:35 -0400 Subject: [PATCH 05/24] try sparse checkout --- .github/workflows/daily-dev-bump.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/daily-dev-bump.yaml b/.github/workflows/daily-dev-bump.yaml index f7e099acbef..b5b24e87b3a 100644 --- a/.github/workflows/daily-dev-bump.yaml +++ b/.github/workflows/daily-dev-bump.yaml @@ -128,6 +128,11 @@ jobs: name: Clean up 5 Dev Bump Branches runs-on: ubuntu-latest steps: + - name: Sparse checkout of the repository + uses: actions/checkout@v3 + with: + sparse-checkout: | + README.md - name: Clean up branches run: | # Get 5 most recent branches of closed DartDevtoolWorkflowBot PRs. From ea342e3206236953d2c0aa220a64cfdb435cae3f Mon Sep 17 00:00:00 2001 From: Dan Chevalier Date: Thu, 24 Aug 2023 14:37:42 -0400 Subject: [PATCH 06/24] set debug print --- .github/workflows/daily-dev-bump.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/daily-dev-bump.yaml b/.github/workflows/daily-dev-bump.yaml index b5b24e87b3a..40a0d9604e2 100644 --- a/.github/workflows/daily-dev-bump.yaml +++ b/.github/workflows/daily-dev-bump.yaml @@ -135,6 +135,7 @@ jobs: README.md - name: Clean up branches run: | + set -x # Get 5 most recent branches of closed DartDevtoolWorkflowBot PRs. CLOSED_BRANCH_NAMES=$(gh pr list -A DartDevtoolWorkflowBot -s closed -L 5 --search sort:created-desc | grep auto-bump- | sed 's|.*\(auto-bump-[[:digit:]]*\).*|\1|') From f45a8a8baf7ce456222dd4b8572acbf6c0c911e5 Mon Sep 17 00:00:00 2001 From: Dan Chevalier Date: Thu, 24 Aug 2023 14:44:54 -0400 Subject: [PATCH 07/24] remove existing check --- .github/workflows/daily-dev-bump.yaml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/.github/workflows/daily-dev-bump.yaml b/.github/workflows/daily-dev-bump.yaml index 40a0d9604e2..6e52a31d23c 100644 --- a/.github/workflows/daily-dev-bump.yaml +++ b/.github/workflows/daily-dev-bump.yaml @@ -137,15 +137,11 @@ jobs: run: | set -x # Get 5 most recent branches of closed DartDevtoolWorkflowBot PRs. - CLOSED_BRANCH_NAMES=$(gh pr list -A DartDevtoolWorkflowBot -s closed -L 5 --search sort:created-desc | grep auto-bump- | sed 's|.*\(auto-bump-[[:digit:]]*\).*|\1|') + CLOSED_BRANCH_NAMES=$(gh pr list -A DartDevtoolWorkflowBot -s closed -L 10 --search sort:created-desc | grep auto-bump- | sed 's|.*\(auto-bump-[[:digit:]]*\).*|\1|') # Get list of refs(branches) that exist on the remote - EXISTING_REFS=$(git ls-remote --heads | grep refs/heads/auto-bump-) for CLOSED_BRANCH in $CLOSED_BRANCH_NAMES; do - if echo "$EXISTING_REFS" | grep -q "$CLOSED_BRANCH" ; then - # If the branch still exists then we will delete it - gh api /repos/flutter/devtools/git/refs/heads/$CLOSED_BRANCH -X DELETE - fi + gh api /repos/flutter/devtools/git/refs/heads/$CLOSED_BRANCH -X DELETE done env: GH_TOKEN: ${{ secrets.DEVTOOLS_WORKFLOW_BOT_TOKEN }} From 4c476aae20650500ef5fdd62a31ba9c3258d8ed7 Mon Sep 17 00:00:00 2001 From: Dan Chevalier Date: Thu, 24 Aug 2023 14:55:55 -0400 Subject: [PATCH 08/24] much more detailed closure --- .github/workflows/daily-dev-bump.yaml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/daily-dev-bump.yaml b/.github/workflows/daily-dev-bump.yaml index 6e52a31d23c..ee9bb0b71e7 100644 --- a/.github/workflows/daily-dev-bump.yaml +++ b/.github/workflows/daily-dev-bump.yaml @@ -137,11 +137,15 @@ jobs: run: | set -x # Get 5 most recent branches of closed DartDevtoolWorkflowBot PRs. - CLOSED_BRANCH_NAMES=$(gh pr list -A DartDevtoolWorkflowBot -s closed -L 10 --search sort:created-desc | grep auto-bump- | sed 's|.*\(auto-bump-[[:digit:]]*\).*|\1|') # Get list of refs(branches) that exist on the remote - for CLOSED_BRANCH in $CLOSED_BRANCH_NAMES; do - gh api /repos/flutter/devtools/git/refs/heads/$CLOSED_BRANCH -X DELETE + 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 + # 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" + fi done env: GH_TOKEN: ${{ secrets.DEVTOOLS_WORKFLOW_BOT_TOKEN }} From 71a0f0b90f491add5987609f2c43cbf5e47a91d2 Mon Sep 17 00:00:00 2001 From: Dan Chevalier Date: Thu, 24 Aug 2023 15:05:48 -0400 Subject: [PATCH 09/24] way better validation --- .github/workflows/daily-dev-bump.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/daily-dev-bump.yaml b/.github/workflows/daily-dev-bump.yaml index ee9bb0b71e7..c97dc684d2c 100644 --- a/.github/workflows/daily-dev-bump.yaml +++ b/.github/workflows/daily-dev-bump.yaml @@ -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: From 4324a53344d8fdb6c5da01066322b8d14d2df8a2 Mon Sep 17 00:00:00 2001 From: Dan Chevalier Date: Thu, 24 Aug 2023 15:08:07 -0400 Subject: [PATCH 10/24] verbosity and small fix --- .github/workflows/daily-dev-bump.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/daily-dev-bump.yaml b/.github/workflows/daily-dev-bump.yaml index c97dc684d2c..b1b7f41505e 100644 --- a/.github/workflows/daily-dev-bump.yaml +++ b/.github/workflows/daily-dev-bump.yaml @@ -142,9 +142,12 @@ jobs: for EXISTING_BRANCH in $EXISTING_BRANCHES; do 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 [ "$PR_IS_CLOSED" == "true" && "$PR_AUTHOR" == "DartDevtoolWorkflowBot" ] ; then # If the branch exists and the PR is closed we will delete it + echo "Deleting $EXISTING_BRANCH" gh api /repos/flutter/devtools/git/refs/heads/$EXISTING_BRANCH -X DELETE + else + echo "Avoiding $EXISTING_BRANCH with is_closed:$PR_IS_CLOSED and author:$PR_AUTHOR" fi done env: From 2151fb73d15e6ac52635b01450e76ee3318bda5e Mon Sep 17 00:00:00 2001 From: Dan Chevalier Date: Thu, 24 Aug 2023 15:16:58 -0400 Subject: [PATCH 11/24] fix double bracket --- .github/workflows/daily-dev-bump.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/daily-dev-bump.yaml b/.github/workflows/daily-dev-bump.yaml index b1b7f41505e..ddbc174e415 100644 --- a/.github/workflows/daily-dev-bump.yaml +++ b/.github/workflows/daily-dev-bump.yaml @@ -142,7 +142,7 @@ jobs: for EXISTING_BRANCH in $EXISTING_BRANCHES; do 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 [[ "$PR_IS_CLOSED" == "true" && "$PR_AUTHOR" == "DartDevtoolWorkflowBotZ" ]]; then # If the branch exists and the PR is closed we will delete it echo "Deleting $EXISTING_BRANCH" gh api /repos/flutter/devtools/git/refs/heads/$EXISTING_BRANCH -X DELETE From dafff7394e5aeb55c10d040ac38aeaa28924b701 Mon Sep 17 00:00:00 2001 From: Dan Chevalier Date: Thu, 24 Aug 2023 15:19:10 -0400 Subject: [PATCH 12/24] final fix --- .github/workflows/daily-dev-bump.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/daily-dev-bump.yaml b/.github/workflows/daily-dev-bump.yaml index ddbc174e415..b02ce2a44c2 100644 --- a/.github/workflows/daily-dev-bump.yaml +++ b/.github/workflows/daily-dev-bump.yaml @@ -135,14 +135,14 @@ jobs: README.md - name: Clean up branches run: | - set -x + set -e # 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 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" == "DartDevtoolWorkflowBotZ" ]]; then + if [[ "$PR_IS_CLOSED" == "true" && "$PR_AUTHOR" == "DartDevtoolWorkflowBot" ]]; then # If the branch exists and the PR is closed we will delete it echo "Deleting $EXISTING_BRANCH" gh api /repos/flutter/devtools/git/refs/heads/$EXISTING_BRANCH -X DELETE From 54f2b9e841a30dde9fc5c2472124ecb2768edd59 Mon Sep 17 00:00:00 2001 From: Dan Chevalier Date: Thu, 24 Aug 2023 15:28:06 -0400 Subject: [PATCH 13/24] restore others --- .github/workflows/daily-dev-bump.yaml | 191 +++++++++++++------------- 1 file changed, 95 insertions(+), 96 deletions(-) diff --git a/.github/workflows/daily-dev-bump.yaml b/.github/workflows/daily-dev-bump.yaml index b02ce2a44c2..8e8f5b5d793 100644 --- a/.github/workflows/daily-dev-bump.yaml +++ b/.github/workflows/daily-dev-bump.yaml @@ -22,8 +22,6 @@ on: schedule: # * is a special character in YAML so you have to quote this string - cron: "0 8 * * *" # Run every day at midnight Pacific Time - label: - types: [created, deleted] permissions: contents: write pull-requests: write @@ -32,100 +30,101 @@ env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} jobs: - # bump-version: - # if: ${{ (github.event_name == 'workflow_dispatch' || github.event_name == 'schedule') && github.repository == 'flutter/devtools' }} - # name: Bump Version - # runs-on: ubuntu-latest - # steps: - # - name: git clone devtools - # uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 - # with: - # ref: master - - # - uses: dart-lang/setup-dart@d6a63dab3335f427404425de0fbfed4686d93c4f - - # - name: setup git config - # run: | - - # git config user.name "DevTools Workflow Bot" - # git config user.email "dart-devtool-workflow-bot@google.com" - - # - name: Bump the Version - # id: version-bump - # run: | - # set -ex - # pushd tool/ - # dart pub get - # popd - - # ORIGINAL_VERSION=$(dart tool/update_version.dart current-version) - - # if [ -z "$UPDATE_TYPE" ]; then - # # If $UPDATE_TYPE is not set, then assume it is dev - # UPDATE_TYPE="dev" - # fi - - # # If there is a major, minor, or patch bump, do it. - - # if [ "$UPDATE_TYPE" == "patch+dev" ]; then - # dart tool/update_version.dart auto --type patch - # dart tool/update_version.dart auto --type dev - # elif [ "$UPDATE_TYPE" == "minor+dev" ]; then - # dart tool/update_version.dart auto --type minor - # dart tool/update_version.dart auto --type dev - # elif [ "$UPDATE_TYPE" == "major+dev" ]; then - # dart tool/update_version.dart auto --type major - # dart tool/update_version.dart auto --type dev - # elif [ "$UPDATE_TYPE" == "dev" ]; then - # if ! echo "$ORIGINAL_VERSION" | grep -Eq "\-dev\.[0-9]+" ; then - # ERROR_DESCRIPTION="Doing \ - # a Dev bump on a release version ($ORIGINAL_VERSION) is not supported. \ - # Ensure that that current version has been properly bumped to a '-dev.*' \ - # pre-release version, in order to continue daily dev bumps." - - # echo "::error ,title=Cannot do a dev bump on a Release Version ($ORIGINAL_VERSION)::$ERROR_DESCRIPTION" - # exit 1; - # fi - # dart tool/update_version.dart auto --type dev - # else - # echo "ERROR: UNEXPECTED UPDATE TYPE: $UPDATE_TYPE" - # exit 1 - # fi - - # NEW_VERSION=$(dart tool/update_version.dart current-version) - - # echo "COMMIT_MESSAGE=Updating from $ORIGINAL_VERSION to $NEW_VERSION" >> $GITHUB_OUTPUT - # env: - # UPDATE_TYPE: ${{ inputs.updateType }} - - # - name: Create the PR - # run: | - # set -ex - # BRANCH_NAME="auto-bump-$(date +%s)" - # # Stage the file, commit and push - # git checkout -b "$BRANCH_NAME" - # git commit -a -m "$COMMIT_MESSAGE" - # git push -u origin "$BRANCH_NAME" - - # if [ "$IS_DRAFT" == "true" ]; then - # CREATION_FLAGS="--draft" - # fi - - # PR_URL=$(gh pr create --title "$COMMIT_MESSAGE" --body "Automated Version Bump" $CREATION_FLAGS) - - # # Change github credentials back to the actions bot. - # GH_TOKEN="$ORIGINAL_GH_TOKEN" - - # gh pr edit $PR_URL $FLAGS --add-label "autosubmit" - - # env: - # COMMIT_MESSAGE: ${{ steps.version-bump.outputs.COMMIT_MESSAGE }} - # GH_TOKEN: ${{ secrets.DEVTOOLS_WORKFLOW_BOT_TOKEN }} - # ORIGINAL_GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # IS_DRAFT: ${{ inputs.draft == true }} + bump-version: + if: ${{ (github.event_name == 'workflow_dispatch' || github.event_name == 'schedule') && github.repository == 'flutter/devtools' }} + name: Bump Version + runs-on: ubuntu-latest + steps: + - name: git clone devtools + uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 + with: + ref: master + + - uses: dart-lang/setup-dart@d6a63dab3335f427404425de0fbfed4686d93c4f + + - name: setup git config + run: | + + git config user.name "DevTools Workflow Bot" + git config user.email "dart-devtool-workflow-bot@google.com" + + - name: Bump the Version + id: version-bump + run: | + set -ex + pushd tool/ + dart pub get + popd + + ORIGINAL_VERSION=$(dart tool/update_version.dart current-version) + + if [ -z "$UPDATE_TYPE" ]; then + # If $UPDATE_TYPE is not set, then assume it is dev + UPDATE_TYPE="dev" + fi + + # If there is a major, minor, or patch bump, do it. + + if [ "$UPDATE_TYPE" == "patch+dev" ]; then + dart tool/update_version.dart auto --type patch + dart tool/update_version.dart auto --type dev + elif [ "$UPDATE_TYPE" == "minor+dev" ]; then + dart tool/update_version.dart auto --type minor + dart tool/update_version.dart auto --type dev + elif [ "$UPDATE_TYPE" == "major+dev" ]; then + dart tool/update_version.dart auto --type major + dart tool/update_version.dart auto --type dev + elif [ "$UPDATE_TYPE" == "dev" ]; then + if ! echo "$ORIGINAL_VERSION" | grep -Eq "\-dev\.[0-9]+" ; then + ERROR_DESCRIPTION="Doing \ + a Dev bump on a release version ($ORIGINAL_VERSION) is not supported. \ + Ensure that that current version has been properly bumped to a '-dev.*' \ + pre-release version, in order to continue daily dev bumps." + + echo "::error ,title=Cannot do a dev bump on a Release Version ($ORIGINAL_VERSION)::$ERROR_DESCRIPTION" + exit 1; + fi + dart tool/update_version.dart auto --type dev + else + echo "ERROR: UNEXPECTED UPDATE TYPE: $UPDATE_TYPE" + exit 1 + fi + + NEW_VERSION=$(dart tool/update_version.dart current-version) + + echo "COMMIT_MESSAGE=Updating from $ORIGINAL_VERSION to $NEW_VERSION" >> $GITHUB_OUTPUT + env: + UPDATE_TYPE: ${{ inputs.updateType }} + + - name: Create the PR + run: | + set -ex + BRANCH_NAME="auto-bump-$(date +%s)" + # Stage the file, commit and push + git checkout -b "$BRANCH_NAME" + git commit -a -m "$COMMIT_MESSAGE" + git push -u origin "$BRANCH_NAME" + + if [ "$IS_DRAFT" == "true" ]; then + CREATION_FLAGS="--draft" + fi + + PR_URL=$(gh pr create --title "$COMMIT_MESSAGE" --body "Automated Version Bump" $CREATION_FLAGS) + + # Change github credentials back to the actions bot. + GH_TOKEN="$ORIGINAL_GH_TOKEN" + + gh pr edit $PR_URL $FLAGS --add-label "autosubmit" + + env: + COMMIT_MESSAGE: ${{ steps.version-bump.outputs.COMMIT_MESSAGE }} + GH_TOKEN: ${{ secrets.DEVTOOLS_WORKFLOW_BOT_TOKEN }} + ORIGINAL_GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + IS_DRAFT: ${{ inputs.draft == true }} clean-up-branches: # If a pr is closed on a workflow bot PR, then clean up workflow bot branches. - name: Clean up 5 Dev Bump Branches + if: ${{ github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.user.login == 'DartDevtoolWorkflowBot' && github.repository == 'flutter/devtools}} + name: Clean up Dev Bump Branches runs-on: ubuntu-latest steps: - name: Sparse checkout of the repository @@ -137,13 +136,13 @@ jobs: run: | set -e - # Get list of refs(branches) that exist on the remote, then filter for the auto-bump branches + # Get list of 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 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 + # If the branch exists, DartDevtoolWorkflowBot is the author and the PR is closed we will delete it echo "Deleting $EXISTING_BRANCH" gh api /repos/flutter/devtools/git/refs/heads/$EXISTING_BRANCH -X DELETE else From c649870d9a9af52409ecf991d02f3a224c78b282 Mon Sep 17 00:00:00 2001 From: Dan Chevalier Date: Thu, 24 Aug 2023 15:51:31 -0400 Subject: [PATCH 14/24] Move workflowbot cleanup to another workflow --- .github/workflows/daily-dev-bump.yaml | 31 +-------------- .github/workflows/workflow-bot-cleanup.yaml | 43 +++++++++++++++++++++ 2 files changed, 44 insertions(+), 30 deletions(-) create mode 100644 .github/workflows/workflow-bot-cleanup.yaml diff --git a/.github/workflows/daily-dev-bump.yaml b/.github/workflows/daily-dev-bump.yaml index 8e8f5b5d793..8293ce00648 100644 --- a/.github/workflows/daily-dev-bump.yaml +++ b/.github/workflows/daily-dev-bump.yaml @@ -121,33 +121,4 @@ jobs: GH_TOKEN: ${{ secrets.DEVTOOLS_WORKFLOW_BOT_TOKEN }} ORIGINAL_GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} IS_DRAFT: ${{ inputs.draft == true }} - clean-up-branches: - # If a pr is closed on a workflow bot PR, then clean up workflow bot branches. - if: ${{ github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.user.login == 'DartDevtoolWorkflowBot' && github.repository == 'flutter/devtools}} - name: Clean up Dev Bump Branches - runs-on: ubuntu-latest - steps: - - name: Sparse checkout of the repository - uses: actions/checkout@v3 - with: - sparse-checkout: | - README.md - - name: Clean up branches - run: | - set -e - - # Get list of 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 - 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, DartDevtoolWorkflowBot is the author and the PR is closed we will delete it - echo "Deleting $EXISTING_BRANCH" - gh api /repos/flutter/devtools/git/refs/heads/$EXISTING_BRANCH -X DELETE - else - echo "Avoiding $EXISTING_BRANCH with is_closed:$PR_IS_CLOSED and author:$PR_AUTHOR" - fi - done - env: - GH_TOKEN: ${{ secrets.DEVTOOLS_WORKFLOW_BOT_TOKEN }} + diff --git a/.github/workflows/workflow-bot-cleanup.yaml b/.github/workflows/workflow-bot-cleanup.yaml new file mode 100644 index 00000000000..05e4ab3bde5 --- /dev/null +++ b/.github/workflows/workflow-bot-cleanup.yaml @@ -0,0 +1,43 @@ +name: Workflow Bot Cleanup +on: + workflow_dispatch: # Allows for manual triggering if needed + schedule: + # * is a special character in YAML so you have to quote this string + - cron: "0 9 * * *" # Run every day +permissions: + contents: write + pull-requests: write + + +jobs: + clean-up-branches: + if: ${{ github.repository == 'flutter/devtools }} + name: Clean up Dev Bump Branches + runs-on: ubuntu-latest + steps: + - name: Sparse checkout of the repository + uses: actions/checkout@v3 + with: + sparse-checkout: | + README.md + - name: Clean up branches + run: | + set -ex + + # Get list of branches that exist on the remote, then filter for the auto-bump branches + # auto-candidate- + # auto-bump + EXISTING_BRANCHES=$(git ls-remote --heads | grep refs/heads | awk '{print $2}' |sed 's|refs/heads/\(.*\)$|\1|') + for EXISTING_BRANCH in $EXISTING_BRANCHES; do + 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, DartDevtoolWorkflowBot is the author and the PR is closed we will delete it + echo "Deleting $EXISTING_BRANCH" + echo "gh api /repos/flutter/devtools/git/refs/heads/$EXISTING_BRANCH -X DELETE" + else + echo "Avoiding $EXISTING_BRANCH with is_closed:$PR_IS_CLOSED and author:$PR_AUTHOR" + fi + done + env: + GH_TOKEN: ${{ secrets.DEVTOOLS_WORKFLOW_BOT_TOKEN }} From dc636c615443e644af3526d566b6009b9cafc3df Mon Sep 17 00:00:00 2001 From: Dan Chevalier Date: Thu, 24 Aug 2023 15:53:07 -0400 Subject: [PATCH 15/24] fix comment --- .github/workflows/workflow-bot-cleanup.yaml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/workflow-bot-cleanup.yaml b/.github/workflows/workflow-bot-cleanup.yaml index 05e4ab3bde5..86c634fea59 100644 --- a/.github/workflows/workflow-bot-cleanup.yaml +++ b/.github/workflows/workflow-bot-cleanup.yaml @@ -24,9 +24,7 @@ jobs: run: | set -ex - # Get list of branches that exist on the remote, then filter for the auto-bump branches - # auto-candidate- - # auto-bump + # Get list of branches that exist on the remote, then filter for the workflow bot branches EXISTING_BRANCHES=$(git ls-remote --heads | grep refs/heads | awk '{print $2}' |sed 's|refs/heads/\(.*\)$|\1|') for EXISTING_BRANCH in $EXISTING_BRANCHES; do PR_IS_CLOSED=$(gh pr view --json closed --jq '.closed' "$EXISTING_BRANCH") From cff410bd9da756719c6d51a154322c91d02f688f Mon Sep 17 00:00:00 2001 From: Dan Chevalier Date: Thu, 24 Aug 2023 15:53:59 -0400 Subject: [PATCH 16/24] add label trigger --- .github/workflows/workflow-bot-cleanup.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/workflow-bot-cleanup.yaml b/.github/workflows/workflow-bot-cleanup.yaml index 86c634fea59..7abf68d3d5b 100644 --- a/.github/workflows/workflow-bot-cleanup.yaml +++ b/.github/workflows/workflow-bot-cleanup.yaml @@ -4,6 +4,8 @@ on: schedule: # * is a special character in YAML so you have to quote this string - cron: "0 9 * * *" # Run every day + pull_request: # TODO: remove this + types: [ labeled, unlabeled ] permissions: contents: write pull-requests: write From 3d5daee4628420f7622236051ab282d19c614fac Mon Sep 17 00:00:00 2001 From: Dan Chevalier Date: Thu, 24 Aug 2023 16:24:46 -0400 Subject: [PATCH 17/24] missing quote --- .github/workflows/workflow-bot-cleanup.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/workflow-bot-cleanup.yaml b/.github/workflows/workflow-bot-cleanup.yaml index 7abf68d3d5b..03a7e2db813 100644 --- a/.github/workflows/workflow-bot-cleanup.yaml +++ b/.github/workflows/workflow-bot-cleanup.yaml @@ -13,7 +13,7 @@ permissions: jobs: clean-up-branches: - if: ${{ github.repository == 'flutter/devtools }} + if: ${{ github.repository == 'flutter/devtools' }} name: Clean up Dev Bump Branches runs-on: ubuntu-latest steps: From 2dafe434e89cb93710bba0d7d09068ad897771c2 Mon Sep 17 00:00:00 2001 From: Dan Chevalier Date: Fri, 25 Aug 2023 09:35:08 -0400 Subject: [PATCH 18/24] Solidify the code to delete all DartDevtoolWorkflowBot branches that are closed --- .github/workflows/workflow-bot-cleanup.yaml | 24 +++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/.github/workflows/workflow-bot-cleanup.yaml b/.github/workflows/workflow-bot-cleanup.yaml index 03a7e2db813..6c3d0a06833 100644 --- a/.github/workflows/workflow-bot-cleanup.yaml +++ b/.github/workflows/workflow-bot-cleanup.yaml @@ -24,20 +24,32 @@ jobs: README.md - name: Clean up branches run: | - set -ex + set -e # Get list of branches that exist on the remote, then filter for the workflow bot branches EXISTING_BRANCHES=$(git ls-remote --heads | grep refs/heads | awk '{print $2}' |sed 's|refs/heads/\(.*\)$|\1|') for EXISTING_BRANCH in $EXISTING_BRANCHES; do - 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, DartDevtoolWorkflowBot is the author and the PR is closed we will delete it + set +e # Turn off exit on error, since "gh pr view" may fail if branch doesn't exist + PR_INFO=$(gh pr view --json closed,author "$EXISTING_BRANCH") + if [[ $? -ne 0 ]]; then + # If getting PR_INFO fails assume the PR does not exist + echo "SKIP: No PR exists for $EXISTING_BRANCH" + continue + fi + set -e # Turn exit on error back on + + PR_IS_CLOSED=$(echo $PR_INFO | jq -r '.closed') + PR_AUTHOR=$(echo $PR_INFO | jq -r '.author.login') + if [[ "$PR_IS_CLOSED" == "true" ]] && [[ "$PR_AUTHOR" == "DartDevtoolWorkflowBot" ]]; then + # Delete branches where: + # - DartDevtoolWorkflowBot is the author + # - the PR is closed echo "Deleting $EXISTING_BRANCH" echo "gh api /repos/flutter/devtools/git/refs/heads/$EXISTING_BRANCH -X DELETE" else - echo "Avoiding $EXISTING_BRANCH with is_closed:$PR_IS_CLOSED and author:$PR_AUTHOR" + echo "SKIP: Avoiding $EXISTING_BRANCH { is_closed:$PR_IS_CLOSED, author:$PR_AUTHOR }" fi done + env: GH_TOKEN: ${{ secrets.DEVTOOLS_WORKFLOW_BOT_TOKEN }} From 6c345a886b0e6a31f74b3e0eb408c7cbc370f331 Mon Sep 17 00:00:00 2001 From: Dan Chevalier Date: Fri, 25 Aug 2023 09:39:46 -0400 Subject: [PATCH 19/24] remove PR closed trigger for daily dev bump --- .github/workflows/daily-dev-bump.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/daily-dev-bump.yaml b/.github/workflows/daily-dev-bump.yaml index 8293ce00648..c72aeb1556f 100644 --- a/.github/workflows/daily-dev-bump.yaml +++ b/.github/workflows/daily-dev-bump.yaml @@ -17,8 +17,6 @@ on: required: false type: boolean default: false - pull_request: - types: [closed] schedule: # * is a special character in YAML so you have to quote this string - cron: "0 8 * * *" # Run every day at midnight Pacific Time From 18527bf946d44e14d11b13139ed7b2eae32a6850 Mon Sep 17 00:00:00 2001 From: Dan Chevalier Date: Fri, 25 Aug 2023 09:42:37 -0400 Subject: [PATCH 20/24] Last Cleanup --- .github/workflows/workflow-bot-cleanup.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/workflow-bot-cleanup.yaml b/.github/workflows/workflow-bot-cleanup.yaml index 6c3d0a06833..3d2aefa90d9 100644 --- a/.github/workflows/workflow-bot-cleanup.yaml +++ b/.github/workflows/workflow-bot-cleanup.yaml @@ -4,8 +4,6 @@ on: schedule: # * is a special character in YAML so you have to quote this string - cron: "0 9 * * *" # Run every day - pull_request: # TODO: remove this - types: [ labeled, unlabeled ] permissions: contents: write pull-requests: write From 4e66c17e74f8557a928748aff27ea50115d6c0b1 Mon Sep 17 00:00:00 2001 From: Dan Chevalier Date: Fri, 25 Aug 2023 09:52:15 -0400 Subject: [PATCH 21/24] better description --- .github/workflows/workflow-bot-cleanup.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/workflow-bot-cleanup.yaml b/.github/workflows/workflow-bot-cleanup.yaml index 3d2aefa90d9..cb130db502b 100644 --- a/.github/workflows/workflow-bot-cleanup.yaml +++ b/.github/workflows/workflow-bot-cleanup.yaml @@ -12,7 +12,7 @@ permissions: jobs: clean-up-branches: if: ${{ github.repository == 'flutter/devtools' }} - name: Clean up Dev Bump Branches + name: Clean up closed DartDevtoolWorkflowBot Branches runs-on: ubuntu-latest steps: - name: Sparse checkout of the repository @@ -20,7 +20,7 @@ jobs: with: sparse-checkout: | README.md - - name: Clean up branches + - name: Clean up closed DartDevtoolWorkflowBot branches run: | set -e From d359a0cd5ef6b7634e1f0091fa3be870dbf62e85 Mon Sep 17 00:00:00 2001 From: Dan Chevalier Date: Fri, 25 Aug 2023 09:54:28 -0400 Subject: [PATCH 22/24] allow gh api delete to run now --- .github/workflows/workflow-bot-cleanup.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/workflow-bot-cleanup.yaml b/.github/workflows/workflow-bot-cleanup.yaml index cb130db502b..faf30fbf27e 100644 --- a/.github/workflows/workflow-bot-cleanup.yaml +++ b/.github/workflows/workflow-bot-cleanup.yaml @@ -43,7 +43,7 @@ jobs: # - DartDevtoolWorkflowBot is the author # - the PR is closed echo "Deleting $EXISTING_BRANCH" - 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 else echo "SKIP: Avoiding $EXISTING_BRANCH { is_closed:$PR_IS_CLOSED, author:$PR_AUTHOR }" fi From 358a0182b5291709572041d4e15ad3e035089872 Mon Sep 17 00:00:00 2001 From: Dan Chevalier Date: Fri, 25 Aug 2023 10:11:28 -0400 Subject: [PATCH 23/24] protect flutter candidate workflow --- .github/workflows/flutter-candidate-update.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/flutter-candidate-update.yaml b/.github/workflows/flutter-candidate-update.yaml index 71a46e02d43..b7844840787 100644 --- a/.github/workflows/flutter-candidate-update.yaml +++ b/.github/workflows/flutter-candidate-update.yaml @@ -14,6 +14,7 @@ env: jobs: update-candidate: + if: ${{ github.repository == 'flutter/devtools' }} name: Update Flutter Candidate Version runs-on: ubuntu-latest steps: From a7af17e73a5a3af1bae9b840ab5380c20748e3a8 Mon Sep 17 00:00:00 2001 From: Dan Chevalier Date: Fri, 25 Aug 2023 10:12:49 -0400 Subject: [PATCH 24/24] protect daily-dev-bump --- .github/workflows/daily-dev-bump.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/daily-dev-bump.yaml b/.github/workflows/daily-dev-bump.yaml index c72aeb1556f..28f8f6d2fe8 100644 --- a/.github/workflows/daily-dev-bump.yaml +++ b/.github/workflows/daily-dev-bump.yaml @@ -29,7 +29,7 @@ env: jobs: bump-version: - if: ${{ (github.event_name == 'workflow_dispatch' || github.event_name == 'schedule') && github.repository == 'flutter/devtools' }} + if: ${{ github.repository == 'flutter/devtools' }} name: Bump Version runs-on: ubuntu-latest steps: