diff --git a/.github/workflows/dart.yml b/.github/workflows/dart.yml index d6b1e175..4c574c50 100644 --- a/.github/workflows/dart.yml +++ b/.github/workflows/dart.yml @@ -39,16 +39,16 @@ jobs: - name: mono_repo self validate run: dart pub global run mono_repo generate --validate job_002: - name: "analyze_and_format; Dart 3.1.0; PKGS: pkgs/corpus, pkgs/firehose, pkgs/repo_manage; `dart analyze --fatal-infos .`" + name: "analyze_and_format; Dart 3.1.0; PKGS: pkgs/corpus, pkgs/firehose; `dart analyze --fatal-infos .`" runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies uses: actions/cache@69d9d449aced6a2ede0bc19182fadc3a0a42d2b0 with: path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.1.0;packages:pkgs/corpus-pkgs/firehose-pkgs/repo_manage;commands:analyze" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.1.0;packages:pkgs/corpus-pkgs/firehose;commands:analyze" restore-keys: | - os:ubuntu-latest;pub-cache-hosted;sdk:3.1.0;packages:pkgs/corpus-pkgs/firehose-pkgs/repo_manage + os:ubuntu-latest;pub-cache-hosted;sdk:3.1.0;packages:pkgs/corpus-pkgs/firehose os:ubuntu-latest;pub-cache-hosted;sdk:3.1.0 os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest @@ -77,6 +77,29 @@ jobs: run: dart analyze --fatal-infos . if: "always() && steps.pkgs_firehose_pub_upgrade.conclusion == 'success'" working-directory: pkgs/firehose + needs: + - job_001 + job_003: + name: "analyze_and_format; Dart 3.3.0; PKG: pkgs/repo_manage; `dart analyze --fatal-infos .`" + runs-on: ubuntu-latest + steps: + - name: Cache Pub hosted dependencies + uses: actions/cache@69d9d449aced6a2ede0bc19182fadc3a0a42d2b0 + with: + path: "~/.pub-cache/hosted" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.3.0;packages:pkgs/repo_manage;commands:analyze" + restore-keys: | + os:ubuntu-latest;pub-cache-hosted;sdk:3.3.0;packages:pkgs/repo_manage + os:ubuntu-latest;pub-cache-hosted;sdk:3.3.0 + os:ubuntu-latest;pub-cache-hosted + os:ubuntu-latest + - name: Setup Dart SDK + uses: dart-lang/setup-dart@a57a6c04cf7d4840e88432aad6281d1e125f0d46 + with: + sdk: "3.3.0" + - id: checkout + name: Checkout repository + uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c - id: pkgs_repo_manage_pub_upgrade name: pkgs/repo_manage; dart pub upgrade run: dart pub upgrade @@ -88,7 +111,7 @@ jobs: working-directory: pkgs/repo_manage needs: - job_001 - job_003: + job_004: name: "analyze_and_format; Dart 3.4.0; PKG: pkgs/sdk_triage_bot; `dart analyze --fatal-infos .`" runs-on: ubuntu-latest steps: @@ -120,7 +143,7 @@ jobs: working-directory: pkgs/sdk_triage_bot needs: - job_001 - job_004: + job_005: name: "analyze_and_format; Dart 3.5.0; PKG: pkgs/dart_flutter_team_lints; `dart analyze --fatal-infos .`" runs-on: ubuntu-latest steps: @@ -152,7 +175,7 @@ jobs: working-directory: pkgs/dart_flutter_team_lints needs: - job_001 - job_005: + job_006: name: "analyze_and_format; Dart dev; PKGS: pkgs/corpus, pkgs/dart_flutter_team_lints, pkgs/firehose, pkgs/repo_manage, pkgs/sdk_triage_bot; `dart analyze --fatal-infos .`" runs-on: ubuntu-latest steps: @@ -220,7 +243,7 @@ jobs: working-directory: pkgs/sdk_triage_bot needs: - job_001 - job_006: + job_007: name: "analyze_and_format; Dart dev; PKGS: pkgs/corpus, pkgs/dart_flutter_team_lints, pkgs/firehose, pkgs/repo_manage, pkgs/sdk_triage_bot; `dart format --output=none --set-exit-if-changed .`" runs-on: ubuntu-latest steps: @@ -288,7 +311,7 @@ jobs: working-directory: pkgs/sdk_triage_bot needs: - job_001 - job_007: + job_008: name: "unit_test; Dart 3.1.0; PKG: pkgs/corpus; `dart test`" runs-on: ubuntu-latest steps: @@ -325,7 +348,8 @@ jobs: - job_004 - job_005 - job_006 - job_008: + - job_007 + job_009: name: "unit_test; Dart 3.1.0; PKG: pkgs/firehose; `dart test`" runs-on: ubuntu-latest steps: @@ -362,7 +386,8 @@ jobs: - job_004 - job_005 - job_006 - job_009: + - job_007 + job_010: name: "unit_test; Dart 3.4.0; PKG: pkgs/sdk_triage_bot; `dart test`" runs-on: ubuntu-latest steps: @@ -399,7 +424,8 @@ jobs: - job_004 - job_005 - job_006 - job_010: + - job_007 + job_011: name: "unit_test; Dart 3.5.0; PKG: pkgs/dart_flutter_team_lints; `dart test`" runs-on: ubuntu-latest steps: @@ -436,7 +462,8 @@ jobs: - job_004 - job_005 - job_006 - job_011: + - job_007 + job_012: name: "unit_test; Dart dev; PKG: pkgs/corpus; `dart test`" runs-on: ubuntu-latest steps: @@ -473,7 +500,8 @@ jobs: - job_004 - job_005 - job_006 - job_012: + - job_007 + job_013: name: "unit_test; Dart dev; PKG: pkgs/dart_flutter_team_lints; `dart test`" runs-on: ubuntu-latest steps: @@ -510,7 +538,8 @@ jobs: - job_004 - job_005 - job_006 - job_013: + - job_007 + job_014: name: "unit_test; Dart dev; PKG: pkgs/firehose; `dart test`" runs-on: ubuntu-latest steps: @@ -547,7 +576,8 @@ jobs: - job_004 - job_005 - job_006 - job_014: + - job_007 + job_015: name: "unit_test; Dart dev; PKG: pkgs/sdk_triage_bot; `dart test`" runs-on: ubuntu-latest steps: @@ -584,7 +614,8 @@ jobs: - job_004 - job_005 - job_006 - job_015: + - job_007 + job_016: name: "analyze_format; Dart dev; PKG: pkgs/blast_repo; `dart format --output=none --set-exit-if-changed .`, `dart analyze --fatal-infos .`" runs-on: ubuntu-latest steps: @@ -633,7 +664,8 @@ jobs: - job_012 - job_013 - job_014 - job_016: + - job_015 + job_017: name: "test; Dart dev; PKG: pkgs/blast_repo; `dart test --test-randomize-ordering-seed=random`" runs-on: ubuntu-latest steps: @@ -679,3 +711,4 @@ jobs: - job_013 - job_014 - job_015 + - job_016 diff --git a/pkgs/repo_manage/lib/issue_transfer.dart b/pkgs/repo_manage/lib/issue_transfer.dart index 3bed0237..f5b5bf2b 100644 --- a/pkgs/repo_manage/lib/issue_transfer.dart +++ b/pkgs/repo_manage/lib/issue_transfer.dart @@ -2,6 +2,8 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +import 'dart:io'; + import 'package:collection/collection.dart'; import 'package:github/github.dart'; import 'package:graphql/client.dart'; @@ -94,16 +96,21 @@ class TransferIssuesCommand extends ReportCommand { ); print('Transferred ${issues.length} issues'); + if (labelName != null) { - print('Adding label $labelName to all transferred issues'); - for (var issueNumber in issues) { - print('Add to issue $issueNumber'); - if (applyChanges) { - await reportRunner.github.issues.addLabelsToIssue( - targetRepo, - issueNumber, - [labelName], - ); + var label = + getInput('Label the transferred issues with $labelName? (y/N)'); + if (label) { + print('Adding label $labelName to all transferred issues'); + for (var issueNumber in issues) { + print('Add to issue $issueNumber'); + if (applyChanges) { + await reportRunner.github.issues.addLabelsToIssue( + targetRepo, + issueNumber, + [labelName], + ); + } } } } @@ -194,7 +201,12 @@ class TransferIssuesCommand extends ReportCommand { repositoryId, applyChanges, ); - allIssueIds.addAll(transferredIssues); + if (transferredIssues.$2 != null) { + stderr.writeln('Failed to transfer issues.'); + stderr.writeln(transferredIssues.$2); + return allIssueIds; + } + allIssueIds.addAll(transferredIssues.$1); await Future.delayed(const Duration(seconds: 1)); } @@ -209,7 +221,7 @@ class TransferIssuesCommand extends ReportCommand { } } - Future> _transferMutation( + Future<(List, Exception?)> _transferMutation( List issueIds, String repositoryId, bool applyChanges, @@ -239,10 +251,15 @@ class TransferIssuesCommand extends ReportCommand { .toList(); }, )); - if (result.hasException) throw result.exception!; - return result.parsedData ?? []; + return (result.parsedData ?? [], result.exception); } else { - return []; + return ([], null); } } + + bool getInput(String question) { + print(question); + final line = stdin.readLineSync()?.toLowerCase(); + return line == 'y' || line == 'yes'; + } } diff --git a/pkgs/repo_manage/pubspec.yaml b/pkgs/repo_manage/pubspec.yaml index 8292b173..c1945d02 100644 --- a/pkgs/repo_manage/pubspec.yaml +++ b/pkgs/repo_manage/pubspec.yaml @@ -4,7 +4,7 @@ description: Miscellaneous issue, repo, and PR query tools. publish_to: none environment: - sdk: ^3.1.0 + sdk: ^3.3.0 dependencies: args: ^2.4.0