Skip to content

Commit

Permalink
fix saving of comment ids to disk (#221)
Browse files Browse the repository at this point in the history
See the failure here https://github.com/dart-lang/build/actions/runs/7463208455/job/20307339352?pr=3638#step:9:3.

Changes `findCommentId` to again return an `int?` instead of an `IssueComment?`.

Alternatively, we could rename this to `findComment`, and return the entire comment, but we only ever use the ID.

We just call `toString()` on the return value of this function and serialize it to disk, so when it changed to an `IssueComment` it no longer serialized the ID.
  • Loading branch information
jakemac53 authored Jan 9, 2024
1 parent 244a28d commit 1e2785d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
4 changes: 4 additions & 0 deletions pkgs/firehose/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.5.1

- Fix comment ID serialization to disk.

## 0.5.0

- Split health checks in individual workflows.
Expand Down
4 changes: 2 additions & 2 deletions pkgs/firehose/lib/src/github.dart
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class GithubApi {
/// Find a comment on the PR matching the given criteria ([user],
/// [searchTerm]). Return the issue ID if a matching comment is found or null
/// if there's no match.
Future<IssueComment?> findCommentId({
Future<int?> findCommentId({
required String user,
String? searchTerm,
}) async {
Expand All @@ -107,7 +107,7 @@ class GithubApi {
},
orElse: () => null,
);
return matchingComment;
return matchingComment?.id;
}

Future<List<GitFile>> listFilesForPR() async => await github.pullRequests
Expand Down
2 changes: 1 addition & 1 deletion pkgs/firehose/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: firehose
description: A tool to automate publishing of Pub packages from GitHub actions.
version: 0.5.0
version: 0.5.1
repository: https://github.com/dart-lang/ecosystem/tree/main/pkgs/firehose

environment:
Expand Down
4 changes: 2 additions & 2 deletions pkgs/firehose/test/github_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ Future<void> main() async {
});
test('Find comment', () async {
var commentId = await github.findCommentId(user: 'auto-submit[bot]');
expect(commentId?.id, 1660891263);
expect(commentId, 1660891263);
});
test('Find comment with searchterm', () async {
var commentId = await github.findCommentId(
user: 'auto-submit[bot]',
searchTerm: 'before re-applying this label.',
);
expect(commentId?.id, 1660891263);
expect(commentId, 1660891263);
});
test('Find comment with searchterm', () async {
var commentId = await github.findCommentId(
Expand Down

0 comments on commit 1e2785d

Please sign in to comment.