Skip to content

Commit

Permalink
blast_repo: handle GitHub actions with tags like vX (#58)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevmoo authored Feb 7, 2023
1 parent b3b48db commit e4c8c74
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
5 changes: 3 additions & 2 deletions pkgs/blast_repo/lib/src/github_action_resolver.dart
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,10 @@ class GitHubActionResolver {
for (var tag in tags) {
var name = tag.name;
if (name.startsWith('v')) {
// Handle the case (with Dart) where we only do vX.Y instead of vX.Y.Z
// Handle the case (with Dart and melos)
// where we only do vX.Y or vX instead of vX.Y.Z
// TODO(kevmoo): remove this silly once Dart fixes it's tags
if ('.'.allMatches(name).length == 1) {
while ('.'.allMatches(name).length < 2) {
name = '$name.0';
}

Expand Down
24 changes: 14 additions & 10 deletions pkgs/blast_repo/test/github_action_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ void main() {
'master::3284643be2c47fb6432518ecec17f1255e8a06a6',
'codecov/codecov-action@main':
'main::e0fbd592d323cb2991fb586fdd260734fcb41fcb',
'bluefireteam/melos-action@v2':
'v2::dd3c344d731938d2ab2567a261f54a19a68b5f6a',
};

group('parse', () {
Expand Down Expand Up @@ -65,7 +67,7 @@ void main() {
// sha resolved
expect(tag.sha, isNotEmpty);
},
skip: 'flakey due to the the use of unauthenticated github api calls',
skip: 'flaky due to the the use of unauthenticated github api calls',
);
});

Expand All @@ -77,16 +79,18 @@ void main() {
addTearDown(resolver.close);
});

final repo = ActionVersion.parse(actions.keys.first).fullRepo;
for (var action in actions.entries) {
final repo = ActionVersion.parse(action.key).fullRepo;

test(
'"$repo"',
() async {
// TODO(kevmoo): do more than just run - but better than nothing
await resolver.latestStable(repo);
},
skip: 'flakey due to the the use of unauthenticated github api calls',
);
test(
'"$repo"',
() async {
// TODO(kevmoo): do more than just run - but better than nothing
await resolver.latestStable(repo);
},
skip: 'flaky due to the the use of unauthenticated github api calls',
);
}
});
});
}

0 comments on commit e4c8c74

Please sign in to comment.