Skip to content

Commit

Permalink
Update health workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
mosuem committed Jan 4, 2024
1 parent a58c7d8 commit 41f8ca7
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 5 deletions.
10 changes: 10 additions & 0 deletions pkgs/firehose/lib/src/github.dart
Original file line number Diff line number Diff line change
Expand Up @@ -170,4 +170,14 @@ enum FileStatus {

static FileStatus fromString(String s) =>
FileStatus.values.firstWhere((element) => element.name == s);

bool get isRelevant => switch (this) {
FileStatus.added => true,
FileStatus.removed => true,
FileStatus.modified => true,
FileStatus.renamed => true,
FileStatus.copied => true,
FileStatus.changed => true,
FileStatus.unchanged => false,
};
}
20 changes: 15 additions & 5 deletions pkgs/firehose/lib/src/health/health.dart
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,10 @@ Documentation at https://github.com/dart-lang/ecosystem/wiki/Publishing-automati
}

Future<HealthCheckResult> breakingCheck(GithubApi github) async {
final repo = Repository();
final packages = repo.locatePackages();
var changeForPackage = <Package, BreakingChange>{};
var baseDirectory = Directory('../base_repo');
for (var package in packages) {
final filesInPR = await github.listFilesForPR();
final changeForPackage = <Package, BreakingChange>{};
final baseDirectory = Directory('../base_repo');
for (var package in packagesContaining(filesInPR)) {
var currentPath =
path.relative(package.directory.path, from: Directory.current.path);
var basePackage = path.relative(
Expand Down Expand Up @@ -347,6 +346,17 @@ Saving existing comment id $existingCommentId to file ${idFile.path}''');
exitCode = 1;
}
}

List<Package> packagesContaining(List<GitFile> filesInPR) {
var files = filesInPR.where((element) => element.status.isRelevant);
final repo = Repository();
return repo.locatePackages().where((package) {
var relativePackageDirectory =
path.relative(package.directory.path, from: Directory.current.path);
return files.any(
(file) => path.isWithin(relativePackageDirectory, file.relativePath));
}).toList();
}
}

Version getNewVersion(BreakingLevel level, Version oldVersion) {
Expand Down

0 comments on commit 41f8ca7

Please sign in to comment.