From 1249a52d43a2c5212345355479625b28e88032c8 Mon Sep 17 00:00:00 2001 From: Rob Becker Date: Thu, 14 Sep 2023 14:25:12 -0600 Subject: [PATCH 01/23] Revert "Add the 'PushEvent' webhook and associated PushCommit object" (#387) * Revert "Add the 'PushEvent' webhook and associated PushCommit object (#386)" This reverts commit a3b000641113f235196d9d3cfb8fed5ccca18117. * update changelog --------- Co-authored-by: Rob Becker --- CHANGELOG.md | 21 +++-- lib/src/common/model/git.dart | 22 ----- lib/src/common/model/git.g.dart | 18 ---- lib/src/common/model/repos.dart | 14 --- lib/src/common/model/repos.g.dart | 8 +- lib/src/server/hooks.dart | 37 -------- lib/src/server/hooks.g.dart | 28 ------ test/data_object_test.dart | 139 ------------------------------ 8 files changed, 16 insertions(+), 271 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6193c995..836d730e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,6 @@ ## 9.18.0 -* Adds the initial `PushEvent` object in https://github.com/SpinlockLabs/github.dart/pull/386 -* Update the `Repository` values `created_at` and `pushed_at` to handle integer times +- Bad Release. Was: Add the 'PushEvent' webhook and associated PushCommit ## 9.17.0 @@ -312,7 +311,7 @@ Map? files; - Clean up lints https://github.com/SpinlockLabs/github.dart/pull/202 ## 6.0.5 - - Fix null errors issue https://github.com/SpinlockLabs/github.dart/issues/199 + - Fix null errors issue https://github.com/SpinlockLabs/github.dart/issues/199 ## 6.0.4 - This fixes #196 (https://github.com/SpinlockLabs/github.dart/issues/196) @@ -362,10 +361,10 @@ Map? files; Deprecations: -- The `draft` and `prerelease` properties in the CreateRelease and Release +- The `draft` and `prerelease` properties in the CreateRelease and Release - classes have been renamed to `isDraft` and `isPrerelease` for clarity. -- Release.targetCommitsh has been renamed to Release.targetCommitish. -- The `release` parameter in RepositoriesService.createRelease +- Release.targetCommitsh has been renamed to Release.targetCommitish. +- The `release` parameter in RepositoriesService.createRelease has been renamed to `createRelease`. - `RepositoriesService.getRelease` has been renamed to `RepositoriesService.getReleaseById` @@ -374,7 +373,7 @@ has been renamed to `createRelease`. - Add access to labels on Pull Requests https://github.com/SpinlockLabs/github.dart/pull/163 - Adding draft property to PR model https://github.com/SpinlockLabs/github.dart/pull/162 - updateFile request must be a PUT https://github.com/SpinlockLabs/github.dart/pull/160 - + ## v5.1.0 - `Repository`: added `updatedAt` and `license` fields. @@ -391,7 +390,7 @@ has been renamed to `createRelease`. ## v5.0.0 -- **BREAKING** `RepositoriesService.listCollaborators` now returns +- **BREAKING** `RepositoriesService.listCollaborators` now returns `Stream` instead of `Stream`. - `Collaborator` is a new type that includes collaborator-specific information. @@ -408,7 +407,7 @@ has been renamed to `createRelease`. - Removed unsupported `limit` parameter. - Removed flaky retry logic. Instead, `NotReady` is thrown, which can be used to decide to retry at the call site. - - Made associated classes `ContributorStatistics` and + - Made associated classes `ContributorStatistics` and `ContributorWeekStatistics` immutable. Since these classes are only meant as return values, we're not treating this as a breaking change. - Added `Stream github.search.code(...)` search API @@ -438,7 +437,7 @@ has been renamed to `createRelease`. ## v2.3.2 -- Automatically attempt to find GitHub user information in the process environment when running on the standalone VM. +- Automatically attempt to find GitHub user information in the process environment when running on the standalone VM. - Add `ref` parameter to `getReadme` method for the repository service. ## v2.3.1 @@ -452,7 +451,7 @@ has been renamed to `createRelease`. - Moved `CHANGELOG` content back to repo. - Added `rateLimitLimit`, `rateLimitRemaining` and `rateLimitReset` to `GitHub`. - Added `id` to `Issue` -- Added `direction`, `sort` and `since` optional arguments to +- Added `direction`, `sort` and `since` optional arguments to `IssueService.listByRepo`. ## v2.1.0 diff --git a/lib/src/common/model/git.dart b/lib/src/common/model/git.dart index 0e655572..136c01c4 100644 --- a/lib/src/common/model/git.dart +++ b/lib/src/common/model/git.dart @@ -98,28 +98,6 @@ class CreateGitCommit { Map toJson() => _$CreateGitCommitToJson(this); } -/// Model class for a pushed commit. -@JsonSerializable() -class PushGitCommit { - PushGitCommit(this.id, this.message, this.timestamp, this.url); - - /// The commit hash. - String? id; - - /// The commit message. - String? message; - - /// The timestamp of the commit. - DateTime? timestamp; - - /// The direct url to the commit. - String? url; - - factory PushGitCommit.fromJson(Map input) => - _$PushGitCommitFromJson(input); - Map toJson() => _$PushGitCommitToJson(this); -} - /// Model class for an author or committer of a commit. The [GitCommitUser] may /// not correspond to a GitHub [User]. @JsonSerializable(includeIfNull: false) diff --git a/lib/src/common/model/git.g.dart b/lib/src/common/model/git.g.dart index 7b2ba940..61d5fc44 100644 --- a/lib/src/common/model/git.g.dart +++ b/lib/src/common/model/git.g.dart @@ -88,24 +88,6 @@ Map _$CreateGitCommitToJson(CreateGitCommit instance) => 'author': instance.author, }; -PushGitCommit _$PushGitCommitFromJson(Map json) => - PushGitCommit( - json['id'] as String?, - json['message'] as String?, - json['timestamp'] == null - ? null - : DateTime.parse(json['timestamp'] as String), - json['url'] as String?, - ); - -Map _$PushGitCommitToJson(PushGitCommit instance) => - { - 'id': instance.id, - 'message': instance.message, - 'timestamp': instance.timestamp?.toIso8601String(), - 'url': instance.url, - }; - GitCommitUser _$GitCommitUserFromJson(Map json) => GitCommitUser( json['name'] as String?, diff --git a/lib/src/common/model/repos.dart b/lib/src/common/model/repos.dart index 4e46566d..d09c1a7e 100644 --- a/lib/src/common/model/repos.dart +++ b/lib/src/common/model/repos.dart @@ -225,11 +225,9 @@ class Repository { int networkCount; /// The time the repository was created at - @JsonKey(fromJson: Repository.dynamicToDateTime) DateTime? createdAt; /// The last time the repository was pushed at - @JsonKey(fromJson: Repository.dynamicToDateTime) DateTime? pushedAt; DateTime? updatedAt; @@ -461,18 +459,6 @@ class Repository { @override String toString() => 'Repository: $owner/$name'; - - /// In some cases, github webhooks send time values as an integer. This method - /// is added to handle those cases, but otherwise parse like normal. - static DateTime? dynamicToDateTime(dynamic time) { - if (time == null) { - return null; - } - if (time.runtimeType == int) { - return DateTime.fromMillisecondsSinceEpoch(time * 1000); - } - return DateTime.parse(time as String); - } } /// Model class for repository permissions. diff --git a/lib/src/common/model/repos.g.dart b/lib/src/common/model/repos.g.dart index 871a3284..490b18b1 100644 --- a/lib/src/common/model/repos.g.dart +++ b/lib/src/common/model/repos.g.dart @@ -46,7 +46,9 @@ Repository _$RepositoryFromJson(Map json) => Repository( sshUrl: json['ssh_url'] as String? ?? '', svnUrl: json['svn_url'] as String? ?? '', defaultBranch: json['default_branch'] as String? ?? '', - createdAt: Repository.dynamicToDateTime(json['created_at']), + createdAt: json['created_at'] == null + ? null + : DateTime.parse(json['created_at'] as String), isPrivate: json['private'] as bool? ?? false, isFork: json['fork'] as bool? ?? false, stargazersCount: json['stargazers_count'] as int? ?? 0, @@ -66,7 +68,9 @@ Repository _$RepositoryFromJson(Map json) => Repository( updatedAt: json['updated_at'] == null ? null : DateTime.parse(json['updated_at'] as String), - pushedAt: Repository.dynamicToDateTime(json['pushed_at']), + pushedAt: json['pushed_at'] == null + ? null + : DateTime.parse(json['pushed_at'] as String), license: json['license'] == null ? null : LicenseKind.fromJson(json['license'] as Map), diff --git a/lib/src/server/hooks.dart b/lib/src/server/hooks.dart index 3f8987d2..ea250c48 100644 --- a/lib/src/server/hooks.dart +++ b/lib/src/server/hooks.dart @@ -235,40 +235,3 @@ class CreateEvent extends HookEvent { Map toJson() => _$CreateEventToJson(this); } - -@JsonSerializable(fieldRename: FieldRename.snake) -class PushEvent extends HookEvent { - PushEvent({ - this.ref, - this.before, - this.after, - this.repository, - this.headCommit, - this.commits, - this.sender, - }); - - factory PushEvent.fromJson(Map input) => - _$PushEventFromJson(input); - String? ref; - String? before; - String? after; - @JsonKey(toJson: handleIntegerTimes) - Repository? repository; - PushGitCommit? headCommit; - List? commits; - User? sender; - - Map toJson() => _$PushEventToJson(this); - - static Map? handleIntegerTimes(Repository? repository) { - var repositoryMap = repository?.toJson(); - for (final parameter in ['created_at', 'pushed_at']) { - if (repositoryMap?[parameter] != null) { - final createdAt = DateTime.parse(repositoryMap?[parameter]); - repositoryMap?[parameter] = createdAt.millisecondsSinceEpoch ~/ 1000; - } - } - return repositoryMap; - } -} diff --git a/lib/src/server/hooks.g.dart b/lib/src/server/hooks.g.dart index 0e4ca02e..3babd5cf 100644 --- a/lib/src/server/hooks.g.dart +++ b/lib/src/server/hooks.g.dart @@ -173,31 +173,3 @@ Map _$CreateEventToJson(CreateEvent instance) => 'repository': instance.repository, 'sender': instance.sender, }; - -PushEvent _$PushEventFromJson(Map json) => PushEvent( - ref: json['ref'] as String?, - before: json['before'] as String?, - after: json['after'] as String?, - repository: json['repository'] == null - ? null - : Repository.fromJson(json['repository'] as Map), - headCommit: json['head_commit'] == null - ? null - : PushGitCommit.fromJson(json['head_commit'] as Map), - commits: (json['commits'] as List?) - ?.map((e) => PushGitCommit.fromJson(e as Map)) - .toList(), - sender: json['sender'] == null - ? null - : User.fromJson(json['sender'] as Map), - ); - -Map _$PushEventToJson(PushEvent instance) => { - 'ref': instance.ref, - 'before': instance.before, - 'after': instance.after, - 'repository': PushEvent.handleIntegerTimes(instance.repository), - 'head_commit': instance.headCommit, - 'commits': instance.commits, - 'sender': instance.sender, - }; diff --git a/test/data_object_test.dart b/test/data_object_test.dart index 1654b0a6..f1d1d5db 100644 --- a/test/data_object_test.dart +++ b/test/data_object_test.dart @@ -1,7 +1,6 @@ import 'dart:convert'; import 'package:github/github.dart'; -import 'package:github/hooks.dart'; import 'package:test/test.dart'; const _licenseJson = r''' { @@ -30,134 +29,6 @@ const _licenseJson = r''' { } }'''; -const _pushEventJson = r'''{ - "ref": "refs/heads/main", - "before": "def456def456", - "after": "abc123abc123", - "base_ref": null, - "repository": { - "name": "fake-repository", - "id": 680238321, - "full_name": "fakeuser/fake-repository", - "owner": { - "login": "fakeuser", - "id": 102626803, - "avatar_url": "https://avatars.githubusercontent.com/u/102626803?v=4", - "html_url": "https://github.com/fakeuser" - }, - "private": false, - "fork": false, - "html_url": "https://github.com/fakeuser/fake-repository", - "description": "", - "clone_url": "https://github.com/fakeuser/fake-repository.git", - "ssh_url": "git@github.com:fakeuser/fake-repository.git", - "svn_url": "https://github.com/fakeuser/fake-repository", - "git_url": "git://github.com/fakeuser/fake-repository.git", - "homepage": "", - "size": 1, - "stargazers_count": 0, - "watchers_count": 0, - "language": "", - "has_issues": true, - "has_wiki": true, - "has_downloads": true, - "has_pages": false, - "forks_count": 0, - "open_issues_count": 0, - "default_branch": "main", - "subscribers_count": 0, - "network_count": 0, - "created_at": 1692379465, - "pushed_at": 1694031233, - "updated_at": "2023-08-18T17:24:25.000Z", - "archived": false, - "disabled": false, - "allow_forking": true, - "assignees_url": "https://api.github.com/repos/fakeuser/fake-repository/assignees{/user}", - "blobs_url": "https://api.github.com/repos/fakeuser/fake-repository/git/blobs{/sha}", - "branches_url": "https://api.github.com/repos/fakeuser/fake-repository/branches{/branch}", - "collaborators_url": "https://api.github.com/repos/fakeuser/fake-repository/collaborators{/collaborator}", - "comments_url": "https://api.github.com/repos/fakeuser/fake-repository/comments{/number}", - "commits_url": "https://api.github.com/repos/fakeuser/fake-repository/commits{/sha}", - "compare_url": "https://api.github.com/repos/fakeuser/fake-repository/compare/{base}...{head}", - "contents_url": "https://api.github.com/repos/fakeuser/fake-repository/contents/{+path}", - "contributors_url": "https://api.github.com/repos/fakeuser/fake-repository/contributors", - "deployments_url": "https://api.github.com/repos/fakeuser/fake-repository/deployments", - "downloads_url": "https://api.github.com/repos/fakeuser/fake-repository/downloads", - "events_url": "https://api.github.com/repos/fakeuser/fake-repository/events", - "forks": 0, - "forks_url": "https://api.github.com/repos/fakeuser/fake-repository/forks", - "git_commits_url": "https://api.github.com/repos/fakeuser/fake-repository/git/commits{/sha}", - "git_refs_url": "https://api.github.com/repos/fakeuser/fake-repository/git/refs{/sha}", - "git_tags_url": "https://api.github.com/repos/fakeuser/fake-repository/git/tags{/sha}", - "has_discussions": false, - "has_projects": true, - "hooks_url": "https://api.github.com/repos/fakeuser/fake-repository/hooks", - "is_template": false, - "issue_comment_url": "https://api.github.com/repos/fakeuser/fake-repository/issues/comments{/number}", - "issue_events_url": "https://api.github.com/repos/fakeuser/fake-repository/issues/events{/number}", - "issues_url": "https://api.github.com/repos/fakeuser/fake-repository/issues{/number}", - "keys_url": "https://api.github.com/repos/fakeuser/fake-repository/keys{/key_id}", - "labels_url": "https://api.github.com/repos/fakeuser/fake-repository/labels{/name}", - "languages_url": "https://api.github.com/repos/fakeuser/fake-repository/languages", - "master_branch": "main", - "merges_url": "https://api.github.com/repos/fakeuser/fake-repository/merges", - "milestones_url": "https://api.github.com/repos/fakeuser/fake-repository/milestones{/number}", - "node_id": "R_kgDOKIuc8Q", - "notifications_url": "https://api.github.com/repos/fakeuser/fake-repository/notifications{?since,all,participating}", - "open_issues": 0, - "pulls_url": "https://api.github.com/repos/fakeuser/fake-repository/pulls{/number}", - "releases_url": "https://api.github.com/repos/fakeuser/fake-repository/releases{/id}", - "stargazers_url": "https://api.github.com/repos/fakeuser/fake-repository/stargazers", - "statuses_url": "https://api.github.com/repos/fakeuser/fake-repository/statuses/{sha}", - "subscribers_url": "https://api.github.com/repos/fakeuser/fake-repository/subscribers", - "subscription_url": "https://api.github.com/repos/fakeuser/fake-repository/subscription", - "tags_url": "https://api.github.com/repos/fakeuser/fake-repository/tags", - "teams_url": "https://api.github.com/repos/fakeuser/fake-repository/teams", - "topics": [], - "trees_url": "https://api.github.com/repos/fakeuser/fake-repository/git/trees{/sha}", - "url": "https://github.com/fakeuser/fake-repository", - "visibility": "public", - "watchers": 0, - "web_commit_signoff_required": false - }, - "head_commit": { - "id": "f1eab4d20a72fe5495183136e36584dfab447faf", - "message": "A message", - "timestamp": "2023-09-06T15:14:10.000Z", - "url": "fake-github-url.com" - }, - "commits": [ - { - "id": "f1eab4d20a72fe5495183136e36584dfab447faf", - "message": "A message", - "timestamp": "2023-09-06T15:14:10.000Z", - "url": "fake-github-url.com" - } - ], - "sender": { - "login": "fakeuser", - "id": 102626803, - "avatar_url": "https://avatars.githubusercontent.com/u/102626803?v=4", - "html_url": "https://github.com/fakeuser", - "site_admin": false, - "events_url": "https://api.github.com/users/fakeuser/events{/privacy}", - "followers_url": "https://api.github.com/users/fakeuser/followers", - "following_url": "https://api.github.com/users/fakeuser/following{/other_user}", - "gists_url": "https://api.github.com/users/fakeuser/gists{/gist_id}", - "gravatar_id": "", - "node_id": "U_kgDOBh318w", - "organizations_url": "https://api.github.com/users/fakeuser/orgs", - "received_events_url": "https://api.github.com/users/fakeuser/received_events", - "repos_url": "https://api.github.com/users/fakeuser/repos", - "starred_url": "https://api.github.com/users/fakeuser/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/fakeuser/subscriptions", - "type": "User", - "url": "https://api.github.com/users/fakeuser" - } -} -'''; - void main() { test('License round-trip', () { final licenseJson = jsonDecode(_licenseJson) as Map; @@ -168,16 +39,6 @@ void main() { expect(_prettyEncode(toJson), _prettyEncode(licenseJson)); }); - - test('PushEvent round-trip', () { - final pushEventJson = jsonDecode(_pushEventJson) as Map; - - final instance = PushEvent.fromJson(pushEventJson); - - final toJson = instance.toJson(); - - expect(_prettyEncode(toJson), _prettyEncode(pushEventJson)); - }); } String _prettyEncode(obj) => GitHubJson.encode(obj, indent: ' '); From c86afa71aea32e727c02514456432410392a17cb Mon Sep 17 00:00:00 2001 From: Rob Becker Date: Thu, 14 Sep 2023 14:25:45 -0600 Subject: [PATCH 02/23] prep 9.19.0 --- CHANGELOG.md | 7 +++++++ pubspec.yaml | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 836d730e..94e3728c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## 9.19.0 + +* Revert "Add the 'PushEvent' webhook and associated PushCommit object" by @robrbecker in https://github.com/SpinlockLabs/github.dart/pull/387 + + +**Full Changelog**: https://github.com/SpinlockLabs/github.dart/compare/9.18.0...9.19.0 + ## 9.18.0 - Bad Release. Was: Add the 'PushEvent' webhook and associated PushCommit diff --git a/pubspec.yaml b/pubspec.yaml index 9de50e38..8bdc72f6 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: github -version: 9.18.0 +version: 9.19.0 description: A high-level GitHub API Client Library that uses Github's v3 API homepage: https://github.com/SpinlockLabs/github.dart From 01a87bf8c75048857d84d60fe50b5ea07463f248 Mon Sep 17 00:00:00 2001 From: Ricardo Amador <32242716+ricardoamador@users.noreply.github.com> Date: Tue, 14 Nov 2023 09:42:30 -0800 Subject: [PATCH 03/23] Add a Changes object to the PullRequestEvent object so we can see what changed in edited PR events (#390) * Add changes object so we can see what changed in edited PR. * Remove unused import * Formatting. * Make objects const --- lib/src/common/model/changes.dart | 68 ++ lib/src/common/model/changes.g.dart | 71 ++ lib/src/server/hooks.dart | 5 + lib/src/server/hooks.g.dart | 4 + test/server/hooks_test.dart | 25 + test/server/hooks_test_data.dart | 1143 +++++++++++++++++++++++++++ 6 files changed, 1316 insertions(+) create mode 100644 lib/src/common/model/changes.dart create mode 100644 lib/src/common/model/changes.g.dart diff --git a/lib/src/common/model/changes.dart b/lib/src/common/model/changes.dart new file mode 100644 index 00000000..edccdbc5 --- /dev/null +++ b/lib/src/common/model/changes.dart @@ -0,0 +1,68 @@ +import 'package:json_annotation/json_annotation.dart'; +import 'package:meta/meta.dart'; + +part 'changes.g.dart'; + +@immutable +@JsonSerializable() +class Ref { + const Ref(this.from); + final String? from; + + factory Ref.fromJson(Map input) => _$RefFromJson(input); + Map toJson() => _$RefToJson(this); +} + +@immutable +@JsonSerializable() +class Sha { + const Sha(this.from); + final String? from; + + factory Sha.fromJson(Map input) => _$ShaFromJson(input); + Map toJson() => _$ShaToJson(this); +} + +@immutable +@JsonSerializable() +class Base { + const Base(this.ref, this.sha); + final Ref? ref; + final Sha? sha; + + factory Base.fromJson(Map input) => _$BaseFromJson(input); + Map toJson() => _$BaseToJson(this); +} + +@immutable +@JsonSerializable() +class Body { + const Body(this.from); + final String? from; + + factory Body.fromJson(Map input) => _$BodyFromJson(input); + Map toJson() => _$BodyToJson(this); +} + +@immutable +@JsonSerializable() +class Title { + const Title({this.from}); + final String? from; + + factory Title.fromJson(Map input) => _$TitleFromJson(input); + Map toJson() => _$TitleToJson(this); +} + +@immutable +@JsonSerializable() +class Changes { + const Changes(this.base, this.body, this.title); + final Base? base; + final Body? body; + final Title? title; + + factory Changes.fromJson(Map input) => + _$ChangesFromJson(input); + Map toJson() => _$ChangesToJson(this); +} diff --git a/lib/src/common/model/changes.g.dart b/lib/src/common/model/changes.g.dart new file mode 100644 index 00000000..13e97d0e --- /dev/null +++ b/lib/src/common/model/changes.g.dart @@ -0,0 +1,71 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'changes.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +Ref _$RefFromJson(Map json) => Ref( + json['from'] as String?, + ); + +Map _$RefToJson(Ref instance) => { + 'from': instance.from, + }; + +Sha _$ShaFromJson(Map json) => Sha( + json['from'] as String?, + ); + +Map _$ShaToJson(Sha instance) => { + 'from': instance.from, + }; + +Base _$BaseFromJson(Map json) => Base( + json['ref'] == null + ? null + : Ref.fromJson(json['ref'] as Map), + json['sha'] == null + ? null + : Sha.fromJson(json['sha'] as Map), + ); + +Map _$BaseToJson(Base instance) => { + 'ref': instance.ref, + 'sha': instance.sha, + }; + +Body _$BodyFromJson(Map json) => Body( + json['from'] as String?, + ); + +Map _$BodyToJson(Body instance) => { + 'from': instance.from, + }; + +Title _$TitleFromJson(Map json) => Title( + from: json['from'] as String?, + ); + +Map _$TitleToJson(Title instance) => { + 'from': instance.from, + }; + +Changes _$ChangesFromJson(Map json) => Changes( + json['base'] == null + ? null + : Base.fromJson(json['base'] as Map), + json['body'] == null + ? null + : Body.fromJson(json['body'] as Map), + json['title'] == null + ? null + : Title.fromJson(json['title'] as Map), + ); + +Map _$ChangesToJson(Changes instance) => { + 'base': instance.base, + 'body': instance.body, + 'title': instance.title, + }; diff --git a/lib/src/server/hooks.dart b/lib/src/server/hooks.dart index ea250c48..ae3fa0bf 100644 --- a/lib/src/server/hooks.dart +++ b/lib/src/server/hooks.dart @@ -1,8 +1,11 @@ import 'dart:async'; import 'dart:convert'; import 'dart:io'; + import 'package:json_annotation/json_annotation.dart'; + import '../common.dart'; +import '../common/model/changes.dart'; part 'hooks.g.dart'; @@ -203,12 +206,14 @@ class PullRequestEvent extends HookEvent { this.pullRequest, this.sender, this.repository, + this.changes, }); String? action; int? number; PullRequest? pullRequest; User? sender; Repository? repository; + Changes? changes; factory PullRequestEvent.fromJson(Map input) => _$PullRequestEventFromJson(input); diff --git a/lib/src/server/hooks.g.dart b/lib/src/server/hooks.g.dart index 3babd5cf..e78b6cc9 100644 --- a/lib/src/server/hooks.g.dart +++ b/lib/src/server/hooks.g.dart @@ -142,6 +142,9 @@ PullRequestEvent _$PullRequestEventFromJson(Map json) => repository: json['repository'] == null ? null : Repository.fromJson(json['repository'] as Map), + changes: json['changes'] == null + ? null + : Changes.fromJson(json['changes'] as Map), ); Map _$PullRequestEventToJson(PullRequestEvent instance) => @@ -151,6 +154,7 @@ Map _$PullRequestEventToJson(PullRequestEvent instance) => 'pull_request': instance.pullRequest, 'sender': instance.sender, 'repository': instance.repository, + 'changes': instance.changes, }; CreateEvent _$CreateEventFromJson(Map json) => CreateEvent( diff --git a/test/server/hooks_test.dart b/test/server/hooks_test.dart index 09deae27..d00cb3de 100644 --- a/test/server/hooks_test.dart +++ b/test/server/hooks_test.dart @@ -57,4 +57,29 @@ void main() { expect(sender.htmlUrl, "https://github.com/Codertocat"); }); }); + + group('EditedPullRequest', () { + test('deserialize with body edit', () { + final pullRequestEditedEvent = PullRequestEvent.fromJson( + jsonDecode(prBodyEditedEvent) as Map); + final changes = pullRequestEditedEvent.changes; + expect(changes, isNotNull); + expect(changes!.body!.from, isNotNull); + assert(changes.body!.from == + '**This should not land until https://github.com/flutter/buildroot/pull/790'); + }); + + test('deserialize with base edit', () { + final pullRequestEditedEvent = PullRequestEvent.fromJson( + jsonDecode(prBaseEditedEvent) as Map); + final changes = pullRequestEditedEvent.changes; + expect(changes, isNotNull); + expect(changes!.body, isNull); + expect(changes.base, isNotNull); + expect(changes.base!.ref, isNotNull); + assert(changes.base!.ref!.from == 'main'); + assert(changes.base!.sha!.from == + 'b3af5d64d3e6e2110b07d71909fc432537339659'); + }); + }); } diff --git a/test/server/hooks_test_data.dart b/test/server/hooks_test_data.dart index c6f12f84..4f5b734b 100644 --- a/test/server/hooks_test_data.dart +++ b/test/server/hooks_test_data.dart @@ -672,3 +672,1146 @@ const String createString = ''' } } '''; + +const String prBodyEditedEvent = ''' +{ + "action": "edited", + "number": 47609, + "pull_request": { + "url": "https://api.github.com/repos/flutter/engine/pulls/47609", + "id": 1584723957, + "node_id": "PR_kwDOAlZRSc5edPf1", + "html_url": "https://github.com/flutter/engine/pull/47609", + "diff_url": "https://github.com/flutter/engine/pull/47609.diff", + "patch_url": "https://github.com/flutter/engine/pull/47609.patch", + "issue_url": "https://api.github.com/repos/flutter/engine/issues/47609", + "number": 47609, + "state": "open", + "locked": false, + "title": "Upgrade Android SDK to 34 UpsideDownCake", + "user": { + "login": "gmackall", + "id": 34871572, + "node_id": "MDQ6VXNlcjM0ODcxNTcy", + "avatar_url": "https://avatars.githubusercontent.com/u/34871572?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gmackall", + "html_url": "https://github.com/gmackall", + "followers_url": "https://api.github.com/users/gmackall/followers", + "following_url": "https://api.github.com/users/gmackall/following{/other_user}", + "gists_url": "https://api.github.com/users/gmackall/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gmackall/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gmackall/subscriptions", + "organizations_url": "https://api.github.com/users/gmackall/orgs", + "repos_url": "https://api.github.com/users/gmackall/repos", + "events_url": "https://api.github.com/users/gmackall/events{/privacy}", + "received_events_url": "https://api.github.com/users/gmackall/received_events", + "type": "User", + "site_admin": false + }, + "body": "~**This should not land until https://github.com/flutter/buildroot/pull/790 (re)lands, and I swap the buildroot url back to the latest commit.**~ Reland of PR to update buildroot at https://github.com/flutter/buildroot/pull/792. Upgrades to android api 34 Also: 1. Upgrades to java 17 in DEPS/ci", + "created_at": "2023-11-02T17:09:59Z", + "updated_at": "2023-11-08T21:00:47Z", + "closed_at": null, + "merged_at": null, + "merge_commit_sha": "8e5e3a59a5cba4239c542ed9a914899a246640b7", + "assignee": null, + "assignees": [ + + ], + "requested_reviewers": [ + + ], + "requested_teams": [ + + ], + "labels": [ + { + "id": 246348935, + "node_id": "MDU6TGFiZWwyNDYzNDg5MzU=", + "url": "https://api.github.com/repos/flutter/engine/labels/platform-android", + "name": "platform-android", + "color": "A4C639", + "default": false, + "description": null + } + ], + "milestone": null, + "draft": false, + "commits_url": "https://api.github.com/repos/flutter/engine/pulls/47609/commits", + "review_comments_url": "https://api.github.com/repos/flutter/engine/pulls/47609/comments", + "review_comment_url": "https://api.github.com/repos/flutter/engine/pulls/comments{/number}", + "comments_url": "https://api.github.com/repos/flutter/engine/issues/47609/comments", + "statuses_url": "https://api.github.com/repos/flutter/engine/statuses/a6765b4c309aa082bbebade68e0c7ec308a1cc6c", + "head": { + "label": "gmackall:upgrade_to_android14", + "ref": "upgrade_to_android14", + "sha": "a6765b4c309aa082bbebade68e0c7ec308a1cc6c", + "user": { + "login": "gmackall", + "id": 34871572, + "node_id": "MDQ6VXNlcjM0ODcxNTcy", + "avatar_url": "https://avatars.githubusercontent.com/u/34871572?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gmackall", + "html_url": "https://github.com/gmackall", + "followers_url": "https://api.github.com/users/gmackall/followers", + "following_url": "https://api.github.com/users/gmackall/following{/other_user}", + "gists_url": "https://api.github.com/users/gmackall/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gmackall/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gmackall/subscriptions", + "organizations_url": "https://api.github.com/users/gmackall/orgs", + "repos_url": "https://api.github.com/users/gmackall/repos", + "events_url": "https://api.github.com/users/gmackall/events{/privacy}", + "received_events_url": "https://api.github.com/users/gmackall/received_events", + "type": "User", + "site_admin": false + }, + "repo": { + "id": 547558963, + "node_id": "R_kgDOIKMWMw", + "name": "engine", + "full_name": "gmackall/engine", + "private": false, + "owner": { + "login": "gmackall", + "id": 34871572, + "node_id": "MDQ6VXNlcjM0ODcxNTcy", + "avatar_url": "https://avatars.githubusercontent.com/u/34871572?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gmackall", + "html_url": "https://github.com/gmackall", + "followers_url": "https://api.github.com/users/gmackall/followers", + "following_url": "https://api.github.com/users/gmackall/following{/other_user}", + "gists_url": "https://api.github.com/users/gmackall/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gmackall/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gmackall/subscriptions", + "organizations_url": "https://api.github.com/users/gmackall/orgs", + "repos_url": "https://api.github.com/users/gmackall/repos", + "events_url": "https://api.github.com/users/gmackall/events{/privacy}", + "received_events_url": "https://api.github.com/users/gmackall/received_events", + "type": "User", + "site_admin": false + }, + "html_url": "https://github.com/gmackall/engine", + "description": "The Flutter engine", + "fork": true, + "url": "https://api.github.com/repos/gmackall/engine", + "forks_url": "https://api.github.com/repos/gmackall/engine/forks", + "keys_url": "https://api.github.com/repos/gmackall/engine/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/gmackall/engine/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/gmackall/engine/teams", + "hooks_url": "https://api.github.com/repos/gmackall/engine/hooks", + "issue_events_url": "https://api.github.com/repos/gmackall/engine/issues/events{/number}", + "events_url": "https://api.github.com/repos/gmackall/engine/events", + "assignees_url": "https://api.github.com/repos/gmackall/engine/assignees{/user}", + "branches_url": "https://api.github.com/repos/gmackall/engine/branches{/branch}", + "tags_url": "https://api.github.com/repos/gmackall/engine/tags", + "blobs_url": "https://api.github.com/repos/gmackall/engine/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/gmackall/engine/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/gmackall/engine/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/gmackall/engine/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/gmackall/engine/statuses/{sha}", + "languages_url": "https://api.github.com/repos/gmackall/engine/languages", + "stargazers_url": "https://api.github.com/repos/gmackall/engine/stargazers", + "contributors_url": "https://api.github.com/repos/gmackall/engine/contributors", + "subscribers_url": "https://api.github.com/repos/gmackall/engine/subscribers", + "subscription_url": "https://api.github.com/repos/gmackall/engine/subscription", + "commits_url": "https://api.github.com/repos/gmackall/engine/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/gmackall/engine/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/gmackall/engine/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/gmackall/engine/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/gmackall/engine/contents/{+path}", + "compare_url": "https://api.github.com/repos/gmackall/engine/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/gmackall/engine/merges", + "archive_url": "https://api.github.com/repos/gmackall/engine/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/gmackall/engine/downloads", + "issues_url": "https://api.github.com/repos/gmackall/engine/issues{/number}", + "pulls_url": "https://api.github.com/repos/gmackall/engine/pulls{/number}", + "milestones_url": "https://api.github.com/repos/gmackall/engine/milestones{/number}", + "notifications_url": "https://api.github.com/repos/gmackall/engine/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/gmackall/engine/labels{/name}", + "releases_url": "https://api.github.com/repos/gmackall/engine/releases{/id}", + "deployments_url": "https://api.github.com/repos/gmackall/engine/deployments", + "created_at": "2022-10-07T22:25:57Z", + "updated_at": "2023-02-02T18:38:07Z", + "pushed_at": "2023-11-08T20:57:02Z", + "git_url": "git://github.com/gmackall/engine.git", + "ssh_url": "git@github.com:gmackall/engine.git", + "clone_url": "https://github.com/gmackall/engine.git", + "svn_url": "https://github.com/gmackall/engine", + "homepage": "https://flutter.dev", + "size": 466778, + "stargazers_count": 0, + "watchers_count": 0, + "language": "C++", + "has_issues": false, + "has_projects": true, + "has_downloads": true, + "has_wiki": false, + "has_pages": false, + "has_discussions": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 0, + "license": { + "key": "bsd-3-clause", + "name": "BSD 3-Clause New or Revised License", + "spdx_id": "BSD-3-Clause", + "url": "https://api.github.com/licenses/bsd-3-clause", + "node_id": "MDc6TGljZW5zZTU=" + }, + "allow_forking": true, + "is_template": false, + "web_commit_signoff_required": false, + "topics": [ + + ], + "visibility": "public", + "forks": 0, + "open_issues": 0, + "watchers": 0, + "default_branch": "main", + "allow_squash_merge": true, + "allow_merge_commit": true, + "allow_rebase_merge": true, + "allow_auto_merge": false, + "delete_branch_on_merge": false, + "allow_update_branch": false, + "use_squash_pr_title_as_default": false, + "squash_merge_commit_message": "COMMIT_MESSAGES", + "squash_merge_commit_title": "COMMIT_OR_PR_TITLE", + "merge_commit_message": "PR_TITLE", + "merge_commit_title": "MERGE_MESSAGE" + } + }, + "base": { + "label": "flutter:main", + "ref": "main", + "sha": "941e246d4851f652cf13312180174ebc9395fac4", + "user": { + "login": "flutter", + "id": 14101776, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjE0MTAxNzc2", + "avatar_url": "https://avatars.githubusercontent.com/u/14101776?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/flutter", + "html_url": "https://github.com/flutter", + "followers_url": "https://api.github.com/users/flutter/followers", + "following_url": "https://api.github.com/users/flutter/following{/other_user}", + "gists_url": "https://api.github.com/users/flutter/gists{/gist_id}", + "starred_url": "https://api.github.com/users/flutter/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/flutter/subscriptions", + "organizations_url": "https://api.github.com/users/flutter/orgs", + "repos_url": "https://api.github.com/users/flutter/repos", + "events_url": "https://api.github.com/users/flutter/events{/privacy}", + "received_events_url": "https://api.github.com/users/flutter/received_events", + "type": "Organization", + "site_admin": false + }, + "repo": { + "id": 39211337, + "node_id": "MDEwOlJlcG9zaXRvcnkzOTIxMTMzNw==", + "name": "engine", + "full_name": "flutter/engine", + "private": false, + "owner": { + "login": "flutter", + "id": 14101776, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjE0MTAxNzc2", + "avatar_url": "https://avatars.githubusercontent.com/u/14101776?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/flutter", + "html_url": "https://github.com/flutter", + "followers_url": "https://api.github.com/users/flutter/followers", + "following_url": "https://api.github.com/users/flutter/following{/other_user}", + "gists_url": "https://api.github.com/users/flutter/gists{/gist_id}", + "starred_url": "https://api.github.com/users/flutter/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/flutter/subscriptions", + "organizations_url": "https://api.github.com/users/flutter/orgs", + "repos_url": "https://api.github.com/users/flutter/repos", + "events_url": "https://api.github.com/users/flutter/events{/privacy}", + "received_events_url": "https://api.github.com/users/flutter/received_events", + "type": "Organization", + "site_admin": false + }, + "html_url": "https://github.com/flutter/engine", + "description": "The Flutter engine", + "fork": false, + "url": "https://api.github.com/repos/flutter/engine", + "forks_url": "https://api.github.com/repos/flutter/engine/forks", + "keys_url": "https://api.github.com/repos/flutter/engine/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/flutter/engine/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/flutter/engine/teams", + "hooks_url": "https://api.github.com/repos/flutter/engine/hooks", + "issue_events_url": "https://api.github.com/repos/flutter/engine/issues/events{/number}", + "events_url": "https://api.github.com/repos/flutter/engine/events", + "assignees_url": "https://api.github.com/repos/flutter/engine/assignees{/user}", + "branches_url": "https://api.github.com/repos/flutter/engine/branches{/branch}", + "tags_url": "https://api.github.com/repos/flutter/engine/tags", + "blobs_url": "https://api.github.com/repos/flutter/engine/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/flutter/engine/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/flutter/engine/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/flutter/engine/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/flutter/engine/statuses/{sha}", + "languages_url": "https://api.github.com/repos/flutter/engine/languages", + "stargazers_url": "https://api.github.com/repos/flutter/engine/stargazers", + "contributors_url": "https://api.github.com/repos/flutter/engine/contributors", + "subscribers_url": "https://api.github.com/repos/flutter/engine/subscribers", + "subscription_url": "https://api.github.com/repos/flutter/engine/subscription", + "commits_url": "https://api.github.com/repos/flutter/engine/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/flutter/engine/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/flutter/engine/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/flutter/engine/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/flutter/engine/contents/{+path}", + "compare_url": "https://api.github.com/repos/flutter/engine/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/flutter/engine/merges", + "archive_url": "https://api.github.com/repos/flutter/engine/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/flutter/engine/downloads", + "issues_url": "https://api.github.com/repos/flutter/engine/issues{/number}", + "pulls_url": "https://api.github.com/repos/flutter/engine/pulls{/number}", + "milestones_url": "https://api.github.com/repos/flutter/engine/milestones{/number}", + "notifications_url": "https://api.github.com/repos/flutter/engine/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/flutter/engine/labels{/name}", + "releases_url": "https://api.github.com/repos/flutter/engine/releases{/id}", + "deployments_url": "https://api.github.com/repos/flutter/engine/deployments", + "created_at": "2015-07-16T17:39:56Z", + "updated_at": "2023-11-08T07:16:25Z", + "pushed_at": "2023-11-08T21:00:38Z", + "git_url": "git://github.com/flutter/engine.git", + "ssh_url": "git@github.com:flutter/engine.git", + "clone_url": "https://github.com/flutter/engine.git", + "svn_url": "https://github.com/flutter/engine", + "homepage": "https://flutter.dev", + "size": 704170, + "stargazers_count": 6848, + "watchers_count": 6848, + "language": "C++", + "has_issues": false, + "has_projects": false, + "has_downloads": true, + "has_wiki": false, + "has_pages": false, + "has_discussions": false, + "forks_count": 5600, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 99, + "license": { + "key": "bsd-3-clause", + "name": "BSD 3-Clause New or Revised License", + "spdx_id": "BSD-3-Clause", + "url": "https://api.github.com/licenses/bsd-3-clause", + "node_id": "MDc6TGljZW5zZTU=" + }, + "allow_forking": true, + "is_template": false, + "web_commit_signoff_required": false, + "topics": [ + "c-plus-plus" + ], + "visibility": "public", + "forks": 5600, + "open_issues": 99, + "watchers": 6848, + "default_branch": "main", + "allow_squash_merge": true, + "allow_merge_commit": false, + "allow_rebase_merge": false, + "allow_auto_merge": false, + "delete_branch_on_merge": true, + "allow_update_branch": true, + "use_squash_pr_title_as_default": true, + "squash_merge_commit_message": "PR_BODY", + "squash_merge_commit_title": "PR_TITLE", + "merge_commit_message": "PR_TITLE", + "merge_commit_title": "MERGE_MESSAGE" + } + }, + "_links": { + "self": { + "href": "https://api.github.com/repos/flutter/engine/pulls/47609" + }, + "html": { + "href": "https://github.com/flutter/engine/pull/47609" + }, + "issue": { + "href": "https://api.github.com/repos/flutter/engine/issues/47609" + }, + "comments": { + "href": "https://api.github.com/repos/flutter/engine/issues/47609/comments" + }, + "review_comments": { + "href": "https://api.github.com/repos/flutter/engine/pulls/47609/comments" + }, + "review_comment": { + "href": "https://api.github.com/repos/flutter/engine/pulls/comments{/number}" + }, + "commits": { + "href": "https://api.github.com/repos/flutter/engine/pulls/47609/commits" + }, + "statuses": { + "href": "https://api.github.com/repos/flutter/engine/statuses/a6765b4c309aa082bbebade68e0c7ec308a1cc6c" + } + }, + "author_association": "MEMBER", + "auto_merge": null, + "active_lock_reason": null, + "merged": false, + "mergeable": true, + "rebaseable": true, + "mergeable_state": "clean", + "merged_by": null, + "comments": 4, + "review_comments": 4, + "maintainer_can_modify": true, + "commits": 32, + "additions": 83, + "deletions": 77, + "changed_files": 18 + }, + "changes": { + "body": { + "from": "**This should not land until https://github.com/flutter/buildroot/pull/790" + } + }, + "repository": { + "id": 39211337, + "node_id": "MDEwOlJlcG9zaXRvcnkzOTIxMTMzNw==", + "name": "engine", + "full_name": "flutter/engine", + "private": false, + "owner": { + "login": "flutter", + "id": 14101776, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjE0MTAxNzc2", + "avatar_url": "https://avatars.githubusercontent.com/u/14101776?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/flutter", + "html_url": "https://github.com/flutter", + "followers_url": "https://api.github.com/users/flutter/followers", + "following_url": "https://api.github.com/users/flutter/following{/other_user}", + "gists_url": "https://api.github.com/users/flutter/gists{/gist_id}", + "starred_url": "https://api.github.com/users/flutter/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/flutter/subscriptions", + "organizations_url": "https://api.github.com/users/flutter/orgs", + "repos_url": "https://api.github.com/users/flutter/repos", + "events_url": "https://api.github.com/users/flutter/events{/privacy}", + "received_events_url": "https://api.github.com/users/flutter/received_events", + "type": "Organization", + "site_admin": false + }, + "html_url": "https://github.com/flutter/engine", + "description": "The Flutter engine", + "fork": false, + "url": "https://api.github.com/repos/flutter/engine", + "forks_url": "https://api.github.com/repos/flutter/engine/forks", + "keys_url": "https://api.github.com/repos/flutter/engine/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/flutter/engine/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/flutter/engine/teams", + "hooks_url": "https://api.github.com/repos/flutter/engine/hooks", + "issue_events_url": "https://api.github.com/repos/flutter/engine/issues/events{/number}", + "events_url": "https://api.github.com/repos/flutter/engine/events", + "assignees_url": "https://api.github.com/repos/flutter/engine/assignees{/user}", + "branches_url": "https://api.github.com/repos/flutter/engine/branches{/branch}", + "tags_url": "https://api.github.com/repos/flutter/engine/tags", + "blobs_url": "https://api.github.com/repos/flutter/engine/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/flutter/engine/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/flutter/engine/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/flutter/engine/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/flutter/engine/statuses/{sha}", + "languages_url": "https://api.github.com/repos/flutter/engine/languages", + "stargazers_url": "https://api.github.com/repos/flutter/engine/stargazers", + "contributors_url": "https://api.github.com/repos/flutter/engine/contributors", + "subscribers_url": "https://api.github.com/repos/flutter/engine/subscribers", + "subscription_url": "https://api.github.com/repos/flutter/engine/subscription", + "commits_url": "https://api.github.com/repos/flutter/engine/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/flutter/engine/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/flutter/engine/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/flutter/engine/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/flutter/engine/contents/{+path}", + "compare_url": "https://api.github.com/repos/flutter/engine/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/flutter/engine/merges", + "archive_url": "https://api.github.com/repos/flutter/engine/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/flutter/engine/downloads", + "issues_url": "https://api.github.com/repos/flutter/engine/issues{/number}", + "pulls_url": "https://api.github.com/repos/flutter/engine/pulls{/number}", + "milestones_url": "https://api.github.com/repos/flutter/engine/milestones{/number}", + "notifications_url": "https://api.github.com/repos/flutter/engine/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/flutter/engine/labels{/name}", + "releases_url": "https://api.github.com/repos/flutter/engine/releases{/id}", + "deployments_url": "https://api.github.com/repos/flutter/engine/deployments", + "created_at": "2015-07-16T17:39:56Z", + "updated_at": "2023-11-08T07:16:25Z", + "pushed_at": "2023-11-08T21:00:38Z", + "git_url": "git://github.com/flutter/engine.git", + "ssh_url": "git@github.com:flutter/engine.git", + "clone_url": "https://github.com/flutter/engine.git", + "svn_url": "https://github.com/flutter/engine", + "homepage": "https://flutter.dev", + "size": 704170, + "stargazers_count": 6848, + "watchers_count": 6848, + "language": "C++", + "has_issues": false, + "has_projects": false, + "has_downloads": true, + "has_wiki": false, + "has_pages": false, + "has_discussions": false, + "forks_count": 5600, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 99, + "license": { + "key": "bsd-3-clause", + "name": "BSD 3-Clause New or Revised License", + "spdx_id": "BSD-3-Clause", + "url": "https://api.github.com/licenses/bsd-3-clause", + "node_id": "MDc6TGljZW5zZTU=" + }, + "allow_forking": true, + "is_template": false, + "web_commit_signoff_required": false, + "topics": [ + "c-plus-plus" + ], + "visibility": "public", + "forks": 5600, + "open_issues": 99, + "watchers": 6848, + "default_branch": "main", + "custom_properties": { + + } + }, + "organization": { + "login": "flutter", + "id": 14101776, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjE0MTAxNzc2", + "url": "https://api.github.com/orgs/flutter", + "repos_url": "https://api.github.com/orgs/flutter/repos", + "events_url": "https://api.github.com/orgs/flutter/events", + "hooks_url": "https://api.github.com/orgs/flutter/hooks", + "issues_url": "https://api.github.com/orgs/flutter/issues", + "members_url": "https://api.github.com/orgs/flutter/members{/member}", + "public_members_url": "https://api.github.com/orgs/flutter/public_members{/member}", + "avatar_url": "https://avatars.githubusercontent.com/u/14101776?v=4", + "description": "Flutter is Google's UI toolkit for building beautiful, natively compiled applications for mobile, web, desktop, and embedded devices from a single codebase." + }, + "enterprise": { + "id": 1732, + "slug": "alphabet", + "name": "Alphabet", + "node_id": "MDEwOkVudGVycHJpc2UxNzMy", + "avatar_url": "https://avatars.githubusercontent.com/b/1732?v=4", + "description": "", + "website_url": "https://abc.xyz/", + "html_url": "https://github.com/enterprises/alphabet", + "created_at": "2019-12-19T00:30:52Z", + "updated_at": "2023-01-20T00:41:48Z" + }, + "sender": { + "login": "gmackall", + "id": 34871572, + "node_id": "MDQ6VXNlcjM0ODcxNTcy", + "avatar_url": "https://avatars.githubusercontent.com/u/34871572?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gmackall", + "html_url": "https://github.com/gmackall", + "followers_url": "https://api.github.com/users/gmackall/followers", + "following_url": "https://api.github.com/users/gmackall/following{/other_user}", + "gists_url": "https://api.github.com/users/gmackall/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gmackall/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gmackall/subscriptions", + "organizations_url": "https://api.github.com/users/gmackall/orgs", + "repos_url": "https://api.github.com/users/gmackall/repos", + "events_url": "https://api.github.com/users/gmackall/events{/privacy}", + "received_events_url": "https://api.github.com/users/gmackall/received_events", + "type": "User", + "site_admin": false + }, + "installation": { + "id": 10381585, + "node_id": "MDIzOkludGVncmF0aW9uSW5zdGFsbGF0aW9uMTAzODE1ODU=" + } +} +'''; + +const String prBaseEditedEvent = ''' +{ + "action": "edited", + "number": 47609, + "pull_request": { + "url": "https://api.github.com/repos/flutter/engine/pulls/47609", + "id": 1584723957, + "node_id": "PR_kwDOAlZRSc5edPf1", + "html_url": "https://github.com/flutter/engine/pull/47609", + "diff_url": "https://github.com/flutter/engine/pull/47609.diff", + "patch_url": "https://github.com/flutter/engine/pull/47609.patch", + "issue_url": "https://api.github.com/repos/flutter/engine/issues/47609", + "number": 47609, + "state": "open", + "locked": false, + "title": "Upgrade Android SDK to 34 UpsideDownCake", + "user": { + "login": "gmackall", + "id": 34871572, + "node_id": "MDQ6VXNlcjM0ODcxNTcy", + "avatar_url": "https://avatars.githubusercontent.com/u/34871572?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gmackall", + "html_url": "https://github.com/gmackall", + "followers_url": "https://api.github.com/users/gmackall/followers", + "following_url": "https://api.github.com/users/gmackall/following{/other_user}", + "gists_url": "https://api.github.com/users/gmackall/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gmackall/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gmackall/subscriptions", + "organizations_url": "https://api.github.com/users/gmackall/orgs", + "repos_url": "https://api.github.com/users/gmackall/repos", + "events_url": "https://api.github.com/users/gmackall/events{/privacy}", + "received_events_url": "https://api.github.com/users/gmackall/received_events", + "type": "User", + "site_admin": false + }, + "body": "~**This should not land until https://github.com/flutter/buildroot/pull/790 (re)lands, and I swap the buildroot url back to the latest commit.**~ Reland of PR to update buildroot at https://github.com/flutter/buildroot/pull/792. Upgrades to android api 34 Also: 1. Upgrades to java 17 in DEPS/ci", + "created_at": "2023-11-02T17:09:59Z", + "updated_at": "2023-11-08T21:00:47Z", + "closed_at": null, + "merged_at": null, + "merge_commit_sha": "8e5e3a59a5cba4239c542ed9a914899a246640b7", + "assignee": null, + "assignees": [ + + ], + "requested_reviewers": [ + + ], + "requested_teams": [ + + ], + "labels": [ + { + "id": 246348935, + "node_id": "MDU6TGFiZWwyNDYzNDg5MzU=", + "url": "https://api.github.com/repos/flutter/engine/labels/platform-android", + "name": "platform-android", + "color": "A4C639", + "default": false, + "description": null + } + ], + "milestone": null, + "draft": false, + "commits_url": "https://api.github.com/repos/flutter/engine/pulls/47609/commits", + "review_comments_url": "https://api.github.com/repos/flutter/engine/pulls/47609/comments", + "review_comment_url": "https://api.github.com/repos/flutter/engine/pulls/comments{/number}", + "comments_url": "https://api.github.com/repos/flutter/engine/issues/47609/comments", + "statuses_url": "https://api.github.com/repos/flutter/engine/statuses/a6765b4c309aa082bbebade68e0c7ec308a1cc6c", + "head": { + "label": "gmackall:upgrade_to_android14", + "ref": "upgrade_to_android14", + "sha": "a6765b4c309aa082bbebade68e0c7ec308a1cc6c", + "user": { + "login": "gmackall", + "id": 34871572, + "node_id": "MDQ6VXNlcjM0ODcxNTcy", + "avatar_url": "https://avatars.githubusercontent.com/u/34871572?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gmackall", + "html_url": "https://github.com/gmackall", + "followers_url": "https://api.github.com/users/gmackall/followers", + "following_url": "https://api.github.com/users/gmackall/following{/other_user}", + "gists_url": "https://api.github.com/users/gmackall/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gmackall/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gmackall/subscriptions", + "organizations_url": "https://api.github.com/users/gmackall/orgs", + "repos_url": "https://api.github.com/users/gmackall/repos", + "events_url": "https://api.github.com/users/gmackall/events{/privacy}", + "received_events_url": "https://api.github.com/users/gmackall/received_events", + "type": "User", + "site_admin": false + }, + "repo": { + "id": 547558963, + "node_id": "R_kgDOIKMWMw", + "name": "engine", + "full_name": "gmackall/engine", + "private": false, + "owner": { + "login": "gmackall", + "id": 34871572, + "node_id": "MDQ6VXNlcjM0ODcxNTcy", + "avatar_url": "https://avatars.githubusercontent.com/u/34871572?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gmackall", + "html_url": "https://github.com/gmackall", + "followers_url": "https://api.github.com/users/gmackall/followers", + "following_url": "https://api.github.com/users/gmackall/following{/other_user}", + "gists_url": "https://api.github.com/users/gmackall/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gmackall/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gmackall/subscriptions", + "organizations_url": "https://api.github.com/users/gmackall/orgs", + "repos_url": "https://api.github.com/users/gmackall/repos", + "events_url": "https://api.github.com/users/gmackall/events{/privacy}", + "received_events_url": "https://api.github.com/users/gmackall/received_events", + "type": "User", + "site_admin": false + }, + "html_url": "https://github.com/gmackall/engine", + "description": "The Flutter engine", + "fork": true, + "url": "https://api.github.com/repos/gmackall/engine", + "forks_url": "https://api.github.com/repos/gmackall/engine/forks", + "keys_url": "https://api.github.com/repos/gmackall/engine/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/gmackall/engine/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/gmackall/engine/teams", + "hooks_url": "https://api.github.com/repos/gmackall/engine/hooks", + "issue_events_url": "https://api.github.com/repos/gmackall/engine/issues/events{/number}", + "events_url": "https://api.github.com/repos/gmackall/engine/events", + "assignees_url": "https://api.github.com/repos/gmackall/engine/assignees{/user}", + "branches_url": "https://api.github.com/repos/gmackall/engine/branches{/branch}", + "tags_url": "https://api.github.com/repos/gmackall/engine/tags", + "blobs_url": "https://api.github.com/repos/gmackall/engine/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/gmackall/engine/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/gmackall/engine/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/gmackall/engine/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/gmackall/engine/statuses/{sha}", + "languages_url": "https://api.github.com/repos/gmackall/engine/languages", + "stargazers_url": "https://api.github.com/repos/gmackall/engine/stargazers", + "contributors_url": "https://api.github.com/repos/gmackall/engine/contributors", + "subscribers_url": "https://api.github.com/repos/gmackall/engine/subscribers", + "subscription_url": "https://api.github.com/repos/gmackall/engine/subscription", + "commits_url": "https://api.github.com/repos/gmackall/engine/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/gmackall/engine/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/gmackall/engine/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/gmackall/engine/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/gmackall/engine/contents/{+path}", + "compare_url": "https://api.github.com/repos/gmackall/engine/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/gmackall/engine/merges", + "archive_url": "https://api.github.com/repos/gmackall/engine/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/gmackall/engine/downloads", + "issues_url": "https://api.github.com/repos/gmackall/engine/issues{/number}", + "pulls_url": "https://api.github.com/repos/gmackall/engine/pulls{/number}", + "milestones_url": "https://api.github.com/repos/gmackall/engine/milestones{/number}", + "notifications_url": "https://api.github.com/repos/gmackall/engine/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/gmackall/engine/labels{/name}", + "releases_url": "https://api.github.com/repos/gmackall/engine/releases{/id}", + "deployments_url": "https://api.github.com/repos/gmackall/engine/deployments", + "created_at": "2022-10-07T22:25:57Z", + "updated_at": "2023-02-02T18:38:07Z", + "pushed_at": "2023-11-08T20:57:02Z", + "git_url": "git://github.com/gmackall/engine.git", + "ssh_url": "git@github.com:gmackall/engine.git", + "clone_url": "https://github.com/gmackall/engine.git", + "svn_url": "https://github.com/gmackall/engine", + "homepage": "https://flutter.dev", + "size": 466778, + "stargazers_count": 0, + "watchers_count": 0, + "language": "C++", + "has_issues": false, + "has_projects": true, + "has_downloads": true, + "has_wiki": false, + "has_pages": false, + "has_discussions": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 0, + "license": { + "key": "bsd-3-clause", + "name": "BSD 3-Clause New or Revised License", + "spdx_id": "BSD-3-Clause", + "url": "https://api.github.com/licenses/bsd-3-clause", + "node_id": "MDc6TGljZW5zZTU=" + }, + "allow_forking": true, + "is_template": false, + "web_commit_signoff_required": false, + "topics": [ + + ], + "visibility": "public", + "forks": 0, + "open_issues": 0, + "watchers": 0, + "default_branch": "main", + "allow_squash_merge": true, + "allow_merge_commit": true, + "allow_rebase_merge": true, + "allow_auto_merge": false, + "delete_branch_on_merge": false, + "allow_update_branch": false, + "use_squash_pr_title_as_default": false, + "squash_merge_commit_message": "COMMIT_MESSAGES", + "squash_merge_commit_title": "COMMIT_OR_PR_TITLE", + "merge_commit_message": "PR_TITLE", + "merge_commit_title": "MERGE_MESSAGE" + } + }, + "base": { + "label": "flutter:main", + "ref": "main", + "sha": "941e246d4851f652cf13312180174ebc9395fac4", + "user": { + "login": "flutter", + "id": 14101776, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjE0MTAxNzc2", + "avatar_url": "https://avatars.githubusercontent.com/u/14101776?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/flutter", + "html_url": "https://github.com/flutter", + "followers_url": "https://api.github.com/users/flutter/followers", + "following_url": "https://api.github.com/users/flutter/following{/other_user}", + "gists_url": "https://api.github.com/users/flutter/gists{/gist_id}", + "starred_url": "https://api.github.com/users/flutter/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/flutter/subscriptions", + "organizations_url": "https://api.github.com/users/flutter/orgs", + "repos_url": "https://api.github.com/users/flutter/repos", + "events_url": "https://api.github.com/users/flutter/events{/privacy}", + "received_events_url": "https://api.github.com/users/flutter/received_events", + "type": "Organization", + "site_admin": false + }, + "repo": { + "id": 39211337, + "node_id": "MDEwOlJlcG9zaXRvcnkzOTIxMTMzNw==", + "name": "engine", + "full_name": "flutter/engine", + "private": false, + "owner": { + "login": "flutter", + "id": 14101776, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjE0MTAxNzc2", + "avatar_url": "https://avatars.githubusercontent.com/u/14101776?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/flutter", + "html_url": "https://github.com/flutter", + "followers_url": "https://api.github.com/users/flutter/followers", + "following_url": "https://api.github.com/users/flutter/following{/other_user}", + "gists_url": "https://api.github.com/users/flutter/gists{/gist_id}", + "starred_url": "https://api.github.com/users/flutter/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/flutter/subscriptions", + "organizations_url": "https://api.github.com/users/flutter/orgs", + "repos_url": "https://api.github.com/users/flutter/repos", + "events_url": "https://api.github.com/users/flutter/events{/privacy}", + "received_events_url": "https://api.github.com/users/flutter/received_events", + "type": "Organization", + "site_admin": false + }, + "html_url": "https://github.com/flutter/engine", + "description": "The Flutter engine", + "fork": false, + "url": "https://api.github.com/repos/flutter/engine", + "forks_url": "https://api.github.com/repos/flutter/engine/forks", + "keys_url": "https://api.github.com/repos/flutter/engine/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/flutter/engine/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/flutter/engine/teams", + "hooks_url": "https://api.github.com/repos/flutter/engine/hooks", + "issue_events_url": "https://api.github.com/repos/flutter/engine/issues/events{/number}", + "events_url": "https://api.github.com/repos/flutter/engine/events", + "assignees_url": "https://api.github.com/repos/flutter/engine/assignees{/user}", + "branches_url": "https://api.github.com/repos/flutter/engine/branches{/branch}", + "tags_url": "https://api.github.com/repos/flutter/engine/tags", + "blobs_url": "https://api.github.com/repos/flutter/engine/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/flutter/engine/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/flutter/engine/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/flutter/engine/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/flutter/engine/statuses/{sha}", + "languages_url": "https://api.github.com/repos/flutter/engine/languages", + "stargazers_url": "https://api.github.com/repos/flutter/engine/stargazers", + "contributors_url": "https://api.github.com/repos/flutter/engine/contributors", + "subscribers_url": "https://api.github.com/repos/flutter/engine/subscribers", + "subscription_url": "https://api.github.com/repos/flutter/engine/subscription", + "commits_url": "https://api.github.com/repos/flutter/engine/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/flutter/engine/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/flutter/engine/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/flutter/engine/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/flutter/engine/contents/{+path}", + "compare_url": "https://api.github.com/repos/flutter/engine/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/flutter/engine/merges", + "archive_url": "https://api.github.com/repos/flutter/engine/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/flutter/engine/downloads", + "issues_url": "https://api.github.com/repos/flutter/engine/issues{/number}", + "pulls_url": "https://api.github.com/repos/flutter/engine/pulls{/number}", + "milestones_url": "https://api.github.com/repos/flutter/engine/milestones{/number}", + "notifications_url": "https://api.github.com/repos/flutter/engine/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/flutter/engine/labels{/name}", + "releases_url": "https://api.github.com/repos/flutter/engine/releases{/id}", + "deployments_url": "https://api.github.com/repos/flutter/engine/deployments", + "created_at": "2015-07-16T17:39:56Z", + "updated_at": "2023-11-08T07:16:25Z", + "pushed_at": "2023-11-08T21:00:38Z", + "git_url": "git://github.com/flutter/engine.git", + "ssh_url": "git@github.com:flutter/engine.git", + "clone_url": "https://github.com/flutter/engine.git", + "svn_url": "https://github.com/flutter/engine", + "homepage": "https://flutter.dev", + "size": 704170, + "stargazers_count": 6848, + "watchers_count": 6848, + "language": "C++", + "has_issues": false, + "has_projects": false, + "has_downloads": true, + "has_wiki": false, + "has_pages": false, + "has_discussions": false, + "forks_count": 5600, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 99, + "license": { + "key": "bsd-3-clause", + "name": "BSD 3-Clause New or Revised License", + "spdx_id": "BSD-3-Clause", + "url": "https://api.github.com/licenses/bsd-3-clause", + "node_id": "MDc6TGljZW5zZTU=" + }, + "allow_forking": true, + "is_template": false, + "web_commit_signoff_required": false, + "topics": [ + "c-plus-plus" + ], + "visibility": "public", + "forks": 5600, + "open_issues": 99, + "watchers": 6848, + "default_branch": "main", + "allow_squash_merge": true, + "allow_merge_commit": false, + "allow_rebase_merge": false, + "allow_auto_merge": false, + "delete_branch_on_merge": true, + "allow_update_branch": true, + "use_squash_pr_title_as_default": true, + "squash_merge_commit_message": "PR_BODY", + "squash_merge_commit_title": "PR_TITLE", + "merge_commit_message": "PR_TITLE", + "merge_commit_title": "MERGE_MESSAGE" + } + }, + "_links": { + "self": { + "href": "https://api.github.com/repos/flutter/engine/pulls/47609" + }, + "html": { + "href": "https://github.com/flutter/engine/pull/47609" + }, + "issue": { + "href": "https://api.github.com/repos/flutter/engine/issues/47609" + }, + "comments": { + "href": "https://api.github.com/repos/flutter/engine/issues/47609/comments" + }, + "review_comments": { + "href": "https://api.github.com/repos/flutter/engine/pulls/47609/comments" + }, + "review_comment": { + "href": "https://api.github.com/repos/flutter/engine/pulls/comments{/number}" + }, + "commits": { + "href": "https://api.github.com/repos/flutter/engine/pulls/47609/commits" + }, + "statuses": { + "href": "https://api.github.com/repos/flutter/engine/statuses/a6765b4c309aa082bbebade68e0c7ec308a1cc6c" + } + }, + "author_association": "MEMBER", + "auto_merge": null, + "active_lock_reason": null, + "merged": false, + "mergeable": true, + "rebaseable": true, + "mergeable_state": "clean", + "merged_by": null, + "comments": 4, + "review_comments": 4, + "maintainer_can_modify": true, + "commits": 32, + "additions": 83, + "deletions": 77, + "changed_files": 18 + }, + "changes": { + "base": { + "ref": { + "from": "main" + }, + "sha": { + "from": "b3af5d64d3e6e2110b07d71909fc432537339659" + } + } + }, + "repository": { + "id": 39211337, + "node_id": "MDEwOlJlcG9zaXRvcnkzOTIxMTMzNw==", + "name": "engine", + "full_name": "flutter/engine", + "private": false, + "owner": { + "login": "flutter", + "id": 14101776, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjE0MTAxNzc2", + "avatar_url": "https://avatars.githubusercontent.com/u/14101776?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/flutter", + "html_url": "https://github.com/flutter", + "followers_url": "https://api.github.com/users/flutter/followers", + "following_url": "https://api.github.com/users/flutter/following{/other_user}", + "gists_url": "https://api.github.com/users/flutter/gists{/gist_id}", + "starred_url": "https://api.github.com/users/flutter/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/flutter/subscriptions", + "organizations_url": "https://api.github.com/users/flutter/orgs", + "repos_url": "https://api.github.com/users/flutter/repos", + "events_url": "https://api.github.com/users/flutter/events{/privacy}", + "received_events_url": "https://api.github.com/users/flutter/received_events", + "type": "Organization", + "site_admin": false + }, + "html_url": "https://github.com/flutter/engine", + "description": "The Flutter engine", + "fork": false, + "url": "https://api.github.com/repos/flutter/engine", + "forks_url": "https://api.github.com/repos/flutter/engine/forks", + "keys_url": "https://api.github.com/repos/flutter/engine/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/flutter/engine/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/flutter/engine/teams", + "hooks_url": "https://api.github.com/repos/flutter/engine/hooks", + "issue_events_url": "https://api.github.com/repos/flutter/engine/issues/events{/number}", + "events_url": "https://api.github.com/repos/flutter/engine/events", + "assignees_url": "https://api.github.com/repos/flutter/engine/assignees{/user}", + "branches_url": "https://api.github.com/repos/flutter/engine/branches{/branch}", + "tags_url": "https://api.github.com/repos/flutter/engine/tags", + "blobs_url": "https://api.github.com/repos/flutter/engine/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/flutter/engine/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/flutter/engine/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/flutter/engine/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/flutter/engine/statuses/{sha}", + "languages_url": "https://api.github.com/repos/flutter/engine/languages", + "stargazers_url": "https://api.github.com/repos/flutter/engine/stargazers", + "contributors_url": "https://api.github.com/repos/flutter/engine/contributors", + "subscribers_url": "https://api.github.com/repos/flutter/engine/subscribers", + "subscription_url": "https://api.github.com/repos/flutter/engine/subscription", + "commits_url": "https://api.github.com/repos/flutter/engine/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/flutter/engine/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/flutter/engine/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/flutter/engine/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/flutter/engine/contents/{+path}", + "compare_url": "https://api.github.com/repos/flutter/engine/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/flutter/engine/merges", + "archive_url": "https://api.github.com/repos/flutter/engine/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/flutter/engine/downloads", + "issues_url": "https://api.github.com/repos/flutter/engine/issues{/number}", + "pulls_url": "https://api.github.com/repos/flutter/engine/pulls{/number}", + "milestones_url": "https://api.github.com/repos/flutter/engine/milestones{/number}", + "notifications_url": "https://api.github.com/repos/flutter/engine/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/flutter/engine/labels{/name}", + "releases_url": "https://api.github.com/repos/flutter/engine/releases{/id}", + "deployments_url": "https://api.github.com/repos/flutter/engine/deployments", + "created_at": "2015-07-16T17:39:56Z", + "updated_at": "2023-11-08T07:16:25Z", + "pushed_at": "2023-11-08T21:00:38Z", + "git_url": "git://github.com/flutter/engine.git", + "ssh_url": "git@github.com:flutter/engine.git", + "clone_url": "https://github.com/flutter/engine.git", + "svn_url": "https://github.com/flutter/engine", + "homepage": "https://flutter.dev", + "size": 704170, + "stargazers_count": 6848, + "watchers_count": 6848, + "language": "C++", + "has_issues": false, + "has_projects": false, + "has_downloads": true, + "has_wiki": false, + "has_pages": false, + "has_discussions": false, + "forks_count": 5600, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 99, + "license": { + "key": "bsd-3-clause", + "name": "BSD 3-Clause New or Revised License", + "spdx_id": "BSD-3-Clause", + "url": "https://api.github.com/licenses/bsd-3-clause", + "node_id": "MDc6TGljZW5zZTU=" + }, + "allow_forking": true, + "is_template": false, + "web_commit_signoff_required": false, + "topics": [ + "c-plus-plus" + ], + "visibility": "public", + "forks": 5600, + "open_issues": 99, + "watchers": 6848, + "default_branch": "main", + "custom_properties": { + + } + }, + "organization": { + "login": "flutter", + "id": 14101776, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjE0MTAxNzc2", + "url": "https://api.github.com/orgs/flutter", + "repos_url": "https://api.github.com/orgs/flutter/repos", + "events_url": "https://api.github.com/orgs/flutter/events", + "hooks_url": "https://api.github.com/orgs/flutter/hooks", + "issues_url": "https://api.github.com/orgs/flutter/issues", + "members_url": "https://api.github.com/orgs/flutter/members{/member}", + "public_members_url": "https://api.github.com/orgs/flutter/public_members{/member}", + "avatar_url": "https://avatars.githubusercontent.com/u/14101776?v=4", + "description": "Flutter is Google's UI toolkit for building beautiful, natively compiled applications for mobile, web, desktop, and embedded devices from a single codebase." + }, + "enterprise": { + "id": 1732, + "slug": "alphabet", + "name": "Alphabet", + "node_id": "MDEwOkVudGVycHJpc2UxNzMy", + "avatar_url": "https://avatars.githubusercontent.com/b/1732?v=4", + "description": "", + "website_url": "https://abc.xyz/", + "html_url": "https://github.com/enterprises/alphabet", + "created_at": "2019-12-19T00:30:52Z", + "updated_at": "2023-01-20T00:41:48Z" + }, + "sender": { + "login": "gmackall", + "id": 34871572, + "node_id": "MDQ6VXNlcjM0ODcxNTcy", + "avatar_url": "https://avatars.githubusercontent.com/u/34871572?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gmackall", + "html_url": "https://github.com/gmackall", + "followers_url": "https://api.github.com/users/gmackall/followers", + "following_url": "https://api.github.com/users/gmackall/following{/other_user}", + "gists_url": "https://api.github.com/users/gmackall/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gmackall/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gmackall/subscriptions", + "organizations_url": "https://api.github.com/users/gmackall/orgs", + "repos_url": "https://api.github.com/users/gmackall/repos", + "events_url": "https://api.github.com/users/gmackall/events{/privacy}", + "received_events_url": "https://api.github.com/users/gmackall/received_events", + "type": "User", + "site_admin": false + }, + "installation": { + "id": 10381585, + "node_id": "MDIzOkludGVncmF0aW9uSW5zdGFsbGF0aW9uMTAzODE1ODU=" + } +} +'''; From 94ffec8306dc9c76cb632ae9cf5d6f7265cc7aa8 Mon Sep 17 00:00:00 2001 From: Rob Becker Date: Tue, 14 Nov 2023 10:48:31 -0700 Subject: [PATCH 04/23] prep 9.20.0 --- CHANGELOG.md | 7 +++++++ pubspec.yaml | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 94e3728c..9acbade0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## 9.20.0 + +* Add a Changes object to the PullRequestEvent object so we can see what changed in edited PR events by @ricardoamador in https://github.com/SpinlockLabs/github.dart/pull/390 + + +**Full Changelog**: https://github.com/SpinlockLabs/github.dart/compare/9.19.0...9.20.0 + ## 9.19.0 * Revert "Add the 'PushEvent' webhook and associated PushCommit object" by @robrbecker in https://github.com/SpinlockLabs/github.dart/pull/387 diff --git a/pubspec.yaml b/pubspec.yaml index 8bdc72f6..4fb206a9 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: github -version: 9.19.0 +version: 9.20.0 description: A high-level GitHub API Client Library that uses Github's v3 API homepage: https://github.com/SpinlockLabs/github.dart From 1d4023c62ada078fb624344c842b2344893084e8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 14 Nov 2023 10:53:55 -0700 Subject: [PATCH 05/23] Bump actions/checkout from 3 to 4 (#388) Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v3...v4) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/dart.yml | 2 +- .github/workflows/publish_demos.yml | 2 +- .github/workflows/release_unreleased_prs.yml | 2 +- .github/workflows/triage.yml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/dart.yml b/.github/workflows/dart.yml index 151d23f4..5fb5a1c7 100644 --- a/.github/workflows/dart.yml +++ b/.github/workflows/dart.yml @@ -15,7 +15,7 @@ jobs: # Test with at least the declared minimum Dart version sdk: [2.18.7, stable] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: dart-lang/setup-dart@v1 with: sdk: ${{ matrix.sdk }} diff --git a/.github/workflows/publish_demos.yml b/.github/workflows/publish_demos.yml index 965e7949..3c5fa2e0 100644 --- a/.github/workflows/publish_demos.yml +++ b/.github/workflows/publish_demos.yml @@ -10,7 +10,7 @@ jobs: image: dart steps: - name: Checkout 🛎️ - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install rsync 📚 run: | diff --git a/.github/workflows/release_unreleased_prs.yml b/.github/workflows/release_unreleased_prs.yml index 97f16aa3..2307c913 100644 --- a/.github/workflows/release_unreleased_prs.yml +++ b/.github/workflows/release_unreleased_prs.yml @@ -21,7 +21,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 2 ref: master diff --git a/.github/workflows/triage.yml b/.github/workflows/triage.yml index 224ea1ca..84a45759 100644 --- a/.github/workflows/triage.yml +++ b/.github/workflows/triage.yml @@ -8,7 +8,7 @@ jobs: name: Assign Rob runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Apply untriaged label uses: actions/github-script@v6 with: From d2c7bb288b07cb4e6b46bfa7a485523e59681303 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 14 Nov 2023 10:54:14 -0700 Subject: [PATCH 06/23] Bump JamesIves/github-pages-deploy-action from 4.4.2 to 4.4.3 (#382) Bumps [JamesIves/github-pages-deploy-action](https://github.com/jamesives/github-pages-deploy-action) from 4.4.2 to 4.4.3. - [Release notes](https://github.com/jamesives/github-pages-deploy-action/releases) - [Commits](https://github.com/jamesives/github-pages-deploy-action/compare/v4.4.2...v4.4.3) --- updated-dependencies: - dependency-name: JamesIves/github-pages-deploy-action dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/publish_demos.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish_demos.yml b/.github/workflows/publish_demos.yml index 3c5fa2e0..546140c0 100644 --- a/.github/workflows/publish_demos.yml +++ b/.github/workflows/publish_demos.yml @@ -24,7 +24,7 @@ jobs: rm build/example/packages - name: Publish 🚀 - uses: JamesIves/github-pages-deploy-action@v4.4.2 + uses: JamesIves/github-pages-deploy-action@v4.4.3 with: branch: gh-pages # The branch the action should deploy to. folder: build/example # The folder the action should deploy. From 52f71de142641849cff1121a0d8b33c01549ec57 Mon Sep 17 00:00:00 2001 From: Casey Hillers Date: Wed, 29 Nov 2023 07:36:19 -0800 Subject: [PATCH 07/23] Update release process to use actions (#392) * Update release process to use actions * Add publish pubdev and some minor cleanup --- .github/workflows/create_release.yml | 16 ++ .github/workflows/create_tag.yml | 25 +++ .github/workflows/publish_pubdev.yml | 14 ++ .github/workflows/publish_release.yml | 14 -- .github/workflows/release_unreleased_prs.yml | 36 ---- .github/workflows/require_semver_label.yml | 29 --- CONTRIBUTING.md | 35 ++-- tool/release_unreleased_prs.dart | 178 ------------------- 8 files changed, 65 insertions(+), 282 deletions(-) create mode 100644 .github/workflows/create_release.yml create mode 100644 .github/workflows/create_tag.yml create mode 100644 .github/workflows/publish_pubdev.yml delete mode 100644 .github/workflows/publish_release.yml delete mode 100644 .github/workflows/release_unreleased_prs.yml delete mode 100644 .github/workflows/require_semver_label.yml delete mode 100644 tool/release_unreleased_prs.dart diff --git a/.github/workflows/create_release.yml b/.github/workflows/create_release.yml new file mode 100644 index 00000000..8255c0c0 --- /dev/null +++ b/.github/workflows/create_release.yml @@ -0,0 +1,16 @@ +name: Create Release +on: + push: + tags: + - '*' +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Create a Release + uses: elgohr/Github-Release-Action@v5 + env: + GITHUB_TOKEN: "${{ secrets.RELEASE_TOKEN }}" + with: + title: ${{ github.ref }} diff --git a/.github/workflows/create_tag.yml b/.github/workflows/create_tag.yml new file mode 100644 index 00000000..c5793f0c --- /dev/null +++ b/.github/workflows/create_tag.yml @@ -0,0 +1,25 @@ +name: Release + +# Runs when a PR merges. +# See https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#running-your-workflow-when-a-pull-request-merges +on: + pull_request: + types: + - closed + +jobs: + release: + if: github.event.pull_request.merged == true + runs-on: ubuntu-latest + container: dart + permissions: + contents: write + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + ref: master + - uses: jacopocarlini/action-autotag@3.0.0 + with: + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" diff --git a/.github/workflows/publish_pubdev.yml b/.github/workflows/publish_pubdev.yml new file mode 100644 index 00000000..336e0cf5 --- /dev/null +++ b/.github/workflows/publish_pubdev.yml @@ -0,0 +1,14 @@ +# .github/workflows/publish.yml +name: Publish to pub.dev + +on: + push: + tags: + - '[0-9]+.[0-9]+.[0-9]+*' + +# Publish using the reusable workflow from dart-lang. +jobs: + publish: + permissions: + id-token: write # Required for authentication using OIDC + uses: dart-lang/setup-dart/.github/workflows/publish.yml@v1 \ No newline at end of file diff --git a/.github/workflows/publish_release.yml b/.github/workflows/publish_release.yml deleted file mode 100644 index 853f8c53..00000000 --- a/.github/workflows/publish_release.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: Publish to pub.dev - -on: - push: - tags: - - '[0-9]+.[0-9]+.[0-9]+*' - -permissions: - contents: read - id-token: write - -jobs: - publish: - uses: dart-lang/setup-dart/.github/workflows/publish.yml@v1 diff --git a/.github/workflows/release_unreleased_prs.yml b/.github/workflows/release_unreleased_prs.yml deleted file mode 100644 index 2307c913..00000000 --- a/.github/workflows/release_unreleased_prs.yml +++ /dev/null @@ -1,36 +0,0 @@ -name: Release unreleased PRs - -# Runs when a PR merges. -# See https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#running-your-workflow-when-a-pull-request-merges -on: - workflow_dispatch: - - # Comment out for now and just use manual kickoff of the action - # until we can figure our permissions - # pull_request: - # types: - # - closed - -jobs: - release: - if: github.event.pull_request.merged == true || github.event_name == 'workflow_dispatch' - runs-on: ubuntu-latest - container: dart - permissions: - contents: write - - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 2 - ref: master - - name: Release - run: | - git config --global user.name ${{ secrets.USER_NAME }} - git config --global user.email ${{ secrets.USER_EMAIL }} - export PATH="$PATH":"$HOME/.pub-cache/bin" - export GITHUB_TOKEN=${{secrets.MACHINE_GITHUB_API_TOKEN}} - export MACHINE_GITHUB_API_TOKEN=${{secrets.MACHINE_GITHUB_API_TOKEN}} - dart pub get - dart tool/release_unreleased_prs.dart \ No newline at end of file diff --git a/.github/workflows/require_semver_label.yml b/.github/workflows/require_semver_label.yml deleted file mode 100644 index 0ac40231..00000000 --- a/.github/workflows/require_semver_label.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: Require semver:* and unreleased Label -on: - pull_request: - types: [opened, labeled, unlabeled, synchronize] - -jobs: - label: - runs-on: ubuntu-latest - steps: - - uses: buildsville/add-remove-label@v2.0.0 - if: github.event.action == 'opened' - with: - token: ${{secrets.GITHUB_TOKEN}} - labels: Unreleased - type: add - # - uses: mheap/github-action-required-labels@v3 - # with: - # mode: exactly - # count: 1 - # labels: "semver:patch, semver:minor, semver:major" - # token: ${{secrets.GITHUB_TOKEN}} - # add_comment: Add a semantic version label (semver:patch semver:minor semver:major) - # - uses: mheap/github-action-required-labels@v3 - # with: - # mode: exactly - # count: 1 - # labels: "unreleased" - # token: ${{secrets.GITHUB_TOKEN}} - # add_comment: The unrelease label is required to track which PRs have yet to be released. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c9a832b4..b574e5a8 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -15,7 +15,7 @@ GitHub.dart is of course Open Source! We love it when people contribute! - [Commit your code](http://git-scm.com/book/en/Git-Basics-Recording-Changes-to-the-Repository) for each logical change (see [tips for creating better commit messages](http://robots.thoughtbot.com/5-useful-tips-for-a-better-commit-message)). - [Push your change](https://help.github.com/articles/pushing-to-a-remote) to your fork. - [Create a Pull Request](https://help.github.com/articles/creating-a-pull-request) on GitHub for your change. -- Wait for reviewers (usually kaendfinger) to give feedback. +- Wait for reviewers (usually robrbecker) to give feedback. - When the reviewers think that the Pull Request is ready, they will merge it. ## Code Style @@ -34,12 +34,14 @@ Pull Request rejections are not a bad thing. It just means you need to fix somet To regenerate the JSON logic for the models, run: -``` +```sh dart run build_runner build -d ``` ## Tests +`dart test` will only run the unit tests. + To run the complete test suite you will need to install `octokit/fixtures-server`. @@ -52,29 +54,12 @@ GitHub and execute tests against it using your localhost port 3000. ## Contacting Us -- IRC: `#directcode on irc.esper.net and irc.freenode.net` -- Email: `kaendfinger@gmail.com` - -## Becoming a Committer - -If you get on IRC and ask us, we can review your work and add you as a committer if we think you should have it. - -## Releasing & Publishing - -This repo is now configured to release after every PR merge. This means a couple of things for PRs that are put up: +File issues at https://github.com/SpinlockLabs/github.dart/issues -1. A semver label is required. A GitHub check will remind you that you need one. Reviewers should check that it is correct. See https://semver.org/ to understand more. -2. There is no need to modify the version in the pubspec.yaml in your PRs. The tooling will update the version according to the semver label applied to your PR. -3. Same thing for the CHANGELOG.md. Tooling will update it automatically after merge. -4. A GitHub release will be created and published to pub.dev for you. +## Releases -For example if your PR has `semver:minor` label applied and the latest version is 1.2.3, once merged, the tooling will: -- update the pubspec.yaml to 1.3.0 -- Add the GitHub auto-generated release notes with 1.3.0 to the top of the CHANGELOG.md -- Create a release in GitHub for 1.3.0 (which creates a git tag of 1.3.0) -- Remove the `unreleased` label from the PR and add the `released` label -- Comment on the PR stating the version that it was released in and link to the release -- When the release is created, it will automatically be published to pub.dev +Merged pull requests that edit the `pubspec.yaml` version will create new releases. +Once CI is green, it will create a tag for that commit based on the version, which +gets published by pub.dev. -NOTE: If you want the ability to merge a PR **WITHOUT** automatically releasing and publishing, simply add the `no_release_on_merge` label before merging. Do note that the PR has been merged though and whatever the next PR is that triggers a release will release and publish everything that has been merged. So if you want to batch a few PRs into 1 release, label them all `no_release_on_merge`. Then whichever is the last to be merged, remove that label before merging to trigger the release. -You may also manually trigger the action to release unreleased PRs from the Actions tab in GitHub. +If no new version was created, nothing will be published. diff --git a/tool/release_unreleased_prs.dart b/tool/release_unreleased_prs.dart deleted file mode 100644 index b8cf8b17..00000000 --- a/tool/release_unreleased_prs.dart +++ /dev/null @@ -1,178 +0,0 @@ -import 'dart:io'; -import 'package:github/github.dart'; -import 'package:pub_semver/pub_semver.dart'; -import 'package:yaml_edit/yaml_edit.dart'; - -/////////////////////////////////////////////////////////// -const mainBranchName = 'master'; -const semverMajor = 'semver:major'; -const semverMinor = 'semver:minor'; -const semverPatch = 'semver:patch'; -const semvers = [semverMajor, semverMinor, semverPatch]; -const fullrepo = 'SpinlockLabs/github.dart'; -/////////////////////////////////////////////////////////// - -var _gh = GitHub(auth: findAuthenticationFromEnvironment()); -var _slug = RepositorySlug.full(fullrepo); - -Future main(List args) async { - // get the latest released version - var latestVersion = await getLatestVersion(_slug); - - // get all PRs (issues) that are merged but unreleased - var unreleased = await getUnreleasedPRs(); - - if (unreleased.isEmpty) { - print('No unreleased PRs found'); - return; - } - - // Calculate the next version - var nextVersion = getNextVersion(latestVersion, unreleased); - - // Use the new version to generate release notes - var notes = await generateReleaseNotes(latestVersion.toString(), nextVersion); - - // update the changelog with the new release notes - updateChangeLog(notes, nextVersion); - - // update the version in the pubspec - updatePubspec(nextVersion); - - // commit those changes and push them - commitUpdates(nextVersion); - - // create a new release in github at main - await createRelease(nextVersion, mainBranchName); - - // remove the unreleased labels - for (final i in unreleased) { - await _gh.issues.removeLabelForIssue(_slug, i.number, 'unreleased'); - await _gh.issues.addLabelsToIssue(_slug, i.number, ['released']); - await _gh.issues.createComment(_slug, i.number, - 'Released in version $nextVersion https://github.com/$fullrepo/releases/tag/$nextVersion'); - } - - exit(0); -} - -String run(String cmd, {List? rest}) { - var args = []; - if (rest != null) { - args = rest; - } else { - args = cmd.split(' '); - if (args.isEmpty) { - return ''; - } - cmd = args.removeAt(0); - } - var result = Process.runSync(cmd, args); - if (result.exitCode != 0) { - print('Command failed'); - } - if (result.stdout != null) { - print(result.stdout); - } - if (result.stderr != null) { - print(result.stderr); - } - if (result.exitCode != 0) { - exit(6); - } - - return result.stdout; -} - -Future getLatestVersion(RepositorySlug slug) async { - var latestRelease = await _gh.repositories.getLatestRelease(slug); - var latestTag = latestRelease.tagName!; - print('Latest Tag: $latestTag'); - return Version.parse(latestTag); -} - -Future> getUnreleasedPRs() async { - print('Loading unreleased PRs...'); - var prs = await _gh.search - .issues( - 'repo:${_slug.fullName} is:pull-request label:unreleased -label:no_release_on_merge state:closed', - sort: 'desc') - .toList(); - print('${prs.length} loaded'); - return prs; -} - -String getNextVersion(Version currentVersion, List unreleased) { - var semvers = {}; - for (final pr in unreleased) { - var prlabels = pr.labels - .where((element) => element.name.startsWith('semver:')) - .toList(); - for (final l in prlabels) { - semvers.add(l.name); - } - } - print('Calculating next version based on $semvers'); - var newVersion = ''; - if (semvers.contains('semver:major')) { - newVersion = currentVersion.nextMajor.toString(); - } else if (semvers.contains('semver:minor')) { - newVersion = currentVersion.nextMinor.toString(); - } else if (semvers.contains('semver:patch')) { - newVersion = currentVersion.nextPatch.toString(); - } - print('Next Version: $newVersion'); - return newVersion; -} - -Future generateReleaseNotes( - String fromVersion, String newVersion) async { - var notes = await _gh.repositories.generateReleaseNotes(CreateReleaseNotes( - _slug.owner, _slug.name, newVersion, - previousTagName: fromVersion)); - - var releaseNotes = notes.body.replaceFirst('## What\'s Changed', ''); - - var r = '## $newVersion\n$releaseNotes'; - print(r); - return r; -} - -void updateChangeLog(String notes, String version) { - var log = File('CHANGELOG.md'); - var logdata = log.existsSync() ? log.readAsStringSync() : ''; - if (logdata.contains('## $version')) { - return; - } - log.writeAsStringSync('$notes\n\n$logdata'); -} - -void updatePubspec(String newVersion) { - var f = File('pubspec.yaml'); - var editor = YamlEditor(f.readAsStringSync()); - editor.update(['version'], newVersion); - f.writeAsStringSync(editor.toString()); -} - -Future createRelease(String version, String target) async { - print('Creating release ...'); - var release = await _gh.repositories.createRelease( - _slug, - CreateRelease.from( - tagName: version, - name: version, - generateReleaseNotes: true, - targetCommitish: target, - isDraft: false, - isPrerelease: false)); - - print('Release ${release.name} created ${release.createdAt}'); - print(release.body); - return release; -} - -void commitUpdates(String version) { - run('git add pubspec.yaml CHANGELOG.md'); - run('git', rest: ['commit', '-m', 'prep $version']); - run('git push'); -} From 948c0f9310472c66dc75a8d29b335ee586be0317 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 Dec 2023 11:21:45 -0800 Subject: [PATCH 08/23] Bump JamesIves/github-pages-deploy-action from 4.4.3 to 4.5.0 (#396) Bumps [JamesIves/github-pages-deploy-action](https://github.com/jamesives/github-pages-deploy-action) from 4.4.3 to 4.5.0. - [Release notes](https://github.com/jamesives/github-pages-deploy-action/releases) - [Commits](https://github.com/jamesives/github-pages-deploy-action/compare/v4.4.3...v4.5.0) --- updated-dependencies: - dependency-name: JamesIves/github-pages-deploy-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/publish_demos.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish_demos.yml b/.github/workflows/publish_demos.yml index 546140c0..603b4a09 100644 --- a/.github/workflows/publish_demos.yml +++ b/.github/workflows/publish_demos.yml @@ -24,7 +24,7 @@ jobs: rm build/example/packages - name: Publish 🚀 - uses: JamesIves/github-pages-deploy-action@v4.4.3 + uses: JamesIves/github-pages-deploy-action@v4.5.0 with: branch: gh-pages # The branch the action should deploy to. folder: build/example # The folder the action should deploy. From df7118a9b632a8754db07deccf8f5bf3a75d3620 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 Dec 2023 11:22:08 -0800 Subject: [PATCH 09/23] Bump actions/checkout from 3 to 4 (#395) Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v3...v4) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/create_release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/create_release.yml b/.github/workflows/create_release.yml index 8255c0c0..2c071305 100644 --- a/.github/workflows/create_release.yml +++ b/.github/workflows/create_release.yml @@ -7,7 +7,7 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Create a Release uses: elgohr/Github-Release-Action@v5 env: From 7bc06677699847218e196d86a1839045464fcdec Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 Dec 2023 11:22:27 -0800 Subject: [PATCH 10/23] Bump actions/github-script from 6 to 7 (#394) Bumps [actions/github-script](https://github.com/actions/github-script) from 6 to 7. - [Release notes](https://github.com/actions/github-script/releases) - [Commits](https://github.com/actions/github-script/compare/v6...v7) --- updated-dependencies: - dependency-name: actions/github-script dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/triage.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/triage.yml b/.github/workflows/triage.yml index 84a45759..4d51d30c 100644 --- a/.github/workflows/triage.yml +++ b/.github/workflows/triage.yml @@ -10,7 +10,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Apply untriaged label - uses: actions/github-script@v6 + uses: actions/github-script@v7 with: github-token: ${{secrets.GITHUB_TOKEN}} script: | @@ -21,7 +21,7 @@ jobs: labels: ['untriaged','unreleased'] }) - name: Comment On New Issues - uses: actions/github-script@v6 + uses: actions/github-script@v7 with: github-token: ${{secrets.GITHUB_TOKEN}} script: | From 741c26d0142413b80b89049772a5e693e064ebfb Mon Sep 17 00:00:00 2001 From: Casey Hillers Date: Thu, 28 Dec 2023 09:26:23 -0800 Subject: [PATCH 11/23] Update MiscService.getApiStatus to v2 (#393) * v1 has been deleted Co-authored-by: Rob Becker --- CHANGELOG.md | 5 +++ lib/src/common/misc_service.dart | 4 +- lib/src/common/model/misc.dart | 62 ++++++++++++++++++++++++------ lib/src/common/model/misc.g.dart | 44 ++++++++++++++++----- pubspec.yaml | 2 +- test/common/misc_service_test.dart | 37 ++++++++++++++++++ 6 files changed, 131 insertions(+), 23 deletions(-) create mode 100644 test/common/misc_service_test.dart diff --git a/CHANGELOG.md b/CHANGELOG.md index 9acbade0..953f9937 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 9.21.0 + +* Update MiscService.getApiStatus() to use the v2 API + * `APIStatus` has been refactored to match, now exposing `page` and `status` + ## 9.20.0 * Add a Changes object to the PullRequestEvent object so we can see what changed in edited PR events by @ricardoamador in https://github.com/SpinlockLabs/github.dart/pull/390 diff --git a/lib/src/common/misc_service.dart b/lib/src/common/misc_service.dart index 4951848f..bb351f3d 100644 --- a/lib/src/common/misc_service.dart +++ b/lib/src/common/misc_service.dart @@ -68,8 +68,10 @@ class MiscService extends Service { } /// Gets the GitHub API Status. + /// + /// API docs: https://www.githubstatus.com/api Future getApiStatus() => - github.getJSON('https://status.github.com/api/status.json', + github.getJSON('https://status.github.com/api/v2/status.json', statusCode: StatusCodes.OK, convert: APIStatus.fromJson); /// Returns an ASCII Octocat with the specified [text]. diff --git a/lib/src/common/model/misc.dart b/lib/src/common/model/misc.dart index adf7b2be..18fc0a54 100644 --- a/lib/src/common/model/misc.dart +++ b/lib/src/common/model/misc.dart @@ -60,27 +60,65 @@ class RateLimit { Map toJson() => _$RateLimitToJson(this); } -/// Model class for the GitHub api status. +/// Model class for the GitHub API status. @JsonSerializable() class APIStatus { APIStatus({ + this.page, this.status, - this.lastUpdatedAt, - this.createdOn, - this.message, }); - final String? status; - @JsonKey(name: 'last_updated') - final DateTime? lastUpdatedAt; + /// Details about where to find more information. + final APIStatusPage? page; - @JsonKey(name: 'created_on') - final DateTime? createdOn; - - @JsonKey(name: 'body') - final String? message; + /// An overview of the current status. + final APIStatusMessage? status; factory APIStatus.fromJson(Map input) => _$APIStatusFromJson(input); Map toJson() => _$APIStatusToJson(this); } + +@JsonSerializable() +class APIStatusPage { + const APIStatusPage({ + this.id, + this.name, + this.url, + this.updatedAt, + }); + + /// Unique identifier for the current status. + final String? id; + + final String? name; + + /// Where to get more detailed information. + final String? url; + + @JsonKey(name: 'updated_at') + final DateTime? updatedAt; + + factory APIStatusPage.fromJson(Map input) => + _$APIStatusPageFromJson(input); + Map toJson() => _$APIStatusPageToJson(this); +} + +/// Overview class of the GitHub API status. +@JsonSerializable() +class APIStatusMessage { + const APIStatusMessage({ + this.description, + this.indicator, + }); + + /// A human description of the blended component status. + final String? description; + + /// An indicator - one of none, minor, major, or critical. + final String? indicator; + + factory APIStatusMessage.fromJson(Map input) => + _$APIStatusMessageFromJson(input); + Map toJson() => _$APIStatusMessageToJson(this); +} diff --git a/lib/src/common/model/misc.g.dart b/lib/src/common/model/misc.g.dart index 34362c50..d7b3896c 100644 --- a/lib/src/common/model/misc.g.dart +++ b/lib/src/common/model/misc.g.dart @@ -31,19 +31,45 @@ Map _$RateLimitToJson(RateLimit instance) => { }; APIStatus _$APIStatusFromJson(Map json) => APIStatus( - status: json['status'] as String?, - lastUpdatedAt: json['last_updated'] == null + page: json['page'] == null ? null - : DateTime.parse(json['last_updated'] as String), - createdOn: json['created_on'] == null + : APIStatusPage.fromJson(json['page'] as Map), + status: json['status'] == null ? null - : DateTime.parse(json['created_on'] as String), - message: json['body'] as String?, + : APIStatusMessage.fromJson(json['status'] as Map), ); Map _$APIStatusToJson(APIStatus instance) => { + 'page': instance.page, 'status': instance.status, - 'last_updated': instance.lastUpdatedAt?.toIso8601String(), - 'created_on': instance.createdOn?.toIso8601String(), - 'body': instance.message, + }; + +APIStatusPage _$APIStatusPageFromJson(Map json) => + APIStatusPage( + id: json['id'] as String?, + name: json['name'] as String?, + url: json['url'] as String?, + updatedAt: json['updated_at'] == null + ? null + : DateTime.parse(json['updated_at'] as String), + ); + +Map _$APIStatusPageToJson(APIStatusPage instance) => + { + 'id': instance.id, + 'name': instance.name, + 'url': instance.url, + 'updated_at': instance.updatedAt?.toIso8601String(), + }; + +APIStatusMessage _$APIStatusMessageFromJson(Map json) => + APIStatusMessage( + description: json['description'] as String?, + indicator: json['indicator'] as String?, + ); + +Map _$APIStatusMessageToJson(APIStatusMessage instance) => + { + 'description': instance.description, + 'indicator': instance.indicator, }; diff --git a/pubspec.yaml b/pubspec.yaml index 4fb206a9..0251b7c7 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: github -version: 9.20.0 +version: 9.21.0 description: A high-level GitHub API Client Library that uses Github's v3 API homepage: https://github.com/SpinlockLabs/github.dart diff --git a/test/common/misc_service_test.dart b/test/common/misc_service_test.dart new file mode 100644 index 00000000..2066e271 --- /dev/null +++ b/test/common/misc_service_test.dart @@ -0,0 +1,37 @@ +import 'dart:io'; + +import 'package:github/src/common.dart'; +import 'package:http/http.dart'; +import 'package:http/testing.dart'; +import 'package:test/test.dart'; + +void main() { + MiscService create(Future Function(Request) f) { + final client = MockClient(f); + final github = GitHub(client: client); + return MiscService(github); + } + + test('api status', () async { + final miscService = create( + (_) async => Response(''' +{ + "page":{ + "id":"kctbh9vrtdwd", + "name":"GitHub", + "url":"https://www.githubstatus.com", + "updated_at": "2023-11-29T08:03:04Z" + }, + "status": { + "description": "Partial System Outage", + "indicator": "major" + } +}''', HttpStatus.ok), + ); + final status = await miscService.getApiStatus(); + expect(status.page, isNotNull); + expect(status.page?.id, 'kctbh9vrtdwd'); + expect(status.status, isNotNull); + expect(status.status?.indicator, 'major'); + }); +} From 6b9678e0d207bdf4d74a6d43b84b000e8211de4b Mon Sep 17 00:00:00 2001 From: Moritz Date: Wed, 3 Jan 2024 18:37:11 +0100 Subject: [PATCH 12/23] Make `User` field nullable in `PullRequestReview` (#383) * Make `User` field nullable in `PullRequestReview` * Rev version --- CHANGELOG.md | 4 ++++ lib/src/common/model/pulls.dart | 4 ++-- lib/src/common/model/pulls.g.dart | 4 +++- pubspec.yaml | 2 +- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 953f9937..9665e6e4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 9.22.0 + +* Add support for the `Ghost` user when the Github user is deleted. + ## 9.21.0 * Update MiscService.getApiStatus() to use the v2 API diff --git a/lib/src/common/model/pulls.dart b/lib/src/common/model/pulls.dart index cdbf6ed8..2cb10a8e 100644 --- a/lib/src/common/model/pulls.dart +++ b/lib/src/common/model/pulls.dart @@ -311,14 +311,14 @@ class PullRequestFile { class PullRequestReview { PullRequestReview( {required this.id, - required this.user, + this.user, this.body, this.state, this.htmlUrl, this.pullRequestUrl}); int id; - User user; + User? user; String? body; String? state; String? htmlUrl; diff --git a/lib/src/common/model/pulls.g.dart b/lib/src/common/model/pulls.g.dart index dfe3a3b3..cf370e22 100644 --- a/lib/src/common/model/pulls.g.dart +++ b/lib/src/common/model/pulls.g.dart @@ -253,7 +253,9 @@ Map _$PullRequestFileToJson(PullRequestFile instance) => PullRequestReview _$PullRequestReviewFromJson(Map json) => PullRequestReview( id: json['id'] as int, - user: User.fromJson(json['user'] as Map), + user: json['user'] == null + ? null + : User.fromJson(json['user'] as Map), body: json['body'] as String?, state: json['state'] as String?, htmlUrl: json['html_url'] as String?, diff --git a/pubspec.yaml b/pubspec.yaml index 0251b7c7..af2ff765 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: github -version: 9.21.0 +version: 9.22.0 description: A high-level GitHub API Client Library that uses Github's v3 API homepage: https://github.com/SpinlockLabs/github.dart From e0bd51a6de77b2278d435cda881a56de0758b3be Mon Sep 17 00:00:00 2001 From: Devon Carew Date: Fri, 23 Feb 2024 11:24:18 -0800 Subject: [PATCH 13/23] require dart 3.0; update to the latest package:lints (#399) * require dart 3.0; update to the latest package:lints * update pubspec and changelog --- .github/workflows/dart.yml | 2 +- CHANGELOG.md | 5 +++++ analysis_options.yaml | 2 -- lib/src/common.dart | 2 ++ lib/src/common/activity_service.dart | 2 +- lib/src/common/authorizations_service.dart | 2 +- lib/src/common/checks_service.dart | 9 ++++----- lib/src/common/gists_service.dart | 2 +- lib/src/common/git_service.dart | 2 +- lib/src/common/issues_service.dart | 2 +- lib/src/common/misc_service.dart | 2 +- lib/src/common/model/checks.dart | 10 +++++----- lib/src/common/orgs_service.dart | 2 +- lib/src/common/pulls_service.dart | 2 +- lib/src/common/repos_service.dart | 2 +- lib/src/common/search_service.dart | 2 +- lib/src/common/url_shortener_service.dart | 2 +- lib/src/common/users_service.dart | 2 +- lib/src/common/util/errors.dart | 16 +++++++--------- lib/src/common/util/utils.dart | 2 +- pubspec.yaml | 8 ++++---- test/helper/http.dart | 4 ++-- test/server/hooks_test_data.dart | 1 + tool/process_github_schema.dart | 2 +- 24 files changed, 45 insertions(+), 42 deletions(-) diff --git a/.github/workflows/dart.yml b/.github/workflows/dart.yml index 5fb5a1c7..2d725e23 100644 --- a/.github/workflows/dart.yml +++ b/.github/workflows/dart.yml @@ -13,7 +13,7 @@ jobs: matrix: os: [ubuntu-latest] # Test with at least the declared minimum Dart version - sdk: [2.18.7, stable] + sdk: ['3.0', stable] steps: - uses: actions/checkout@v4 - uses: dart-lang/setup-dart@v1 diff --git a/CHANGELOG.md b/CHANGELOG.md index 9665e6e4..ea5c0870 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 9.23.0 + +* Require Dart 3.0. +* Update to the latest `package:lints`. + ## 9.22.0 * Add support for the `Ghost` user when the Github user is deleted. diff --git a/analysis_options.yaml b/analysis_options.yaml index f7a9ff49..1af8628e 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -15,8 +15,6 @@ linter: - avoid_implementing_value_types - avoid_js_rounded_ints - avoid_private_typedef_functions - - avoid_returning_null - - avoid_returning_null_for_future - avoid_returning_this - avoid_setters_without_getters - avoid_slow_async_io diff --git a/lib/src/common.dart b/lib/src/common.dart index 8ec0f7ae..df783a26 100644 --- a/lib/src/common.dart +++ b/lib/src/common.dart @@ -1,5 +1,7 @@ /// The Core of GitHub for Dart. /// Contains the Models and other GitHub stuff. +library; + export 'package:github/src/common/activity_service.dart'; export 'package:github/src/common/authorizations_service.dart'; export 'package:github/src/common/checks_service.dart'; diff --git a/lib/src/common/activity_service.dart b/lib/src/common/activity_service.dart index 0001fcdc..f69e8c49 100644 --- a/lib/src/common/activity_service.dart +++ b/lib/src/common/activity_service.dart @@ -9,7 +9,7 @@ import 'package:http/http.dart' as http; /// /// API docs: https://developer.github.com/v3/activity/ class ActivityService extends Service { - ActivityService(GitHub github) : super(github); + ActivityService(super.github); /// Lists public events. /// diff --git a/lib/src/common/authorizations_service.dart b/lib/src/common/authorizations_service.dart index 3cbe6ef0..68b80c25 100644 --- a/lib/src/common/authorizations_service.dart +++ b/lib/src/common/authorizations_service.dart @@ -10,7 +10,7 @@ import 'package:github/src/common.dart'; /// /// API docs: https://developer.github.com/v3/oauth_authorizations/ class AuthorizationsService extends Service { - AuthorizationsService(GitHub github) : super(github); + AuthorizationsService(super.github); /// Lists all authorizations. /// diff --git a/lib/src/common/checks_service.dart b/lib/src/common/checks_service.dart index 0e87f4d2..f3085197 100644 --- a/lib/src/common/checks_service.dart +++ b/lib/src/common/checks_service.dart @@ -18,14 +18,13 @@ class ChecksService extends Service { /// API docs: https://developer.github.com/v3/checks/suites/ final CheckSuitesService checkSuites; - ChecksService(GitHub github) + ChecksService(super.github) : checkRuns = CheckRunsService._(github), - checkSuites = CheckSuitesService._(github), - super(github); + checkSuites = CheckSuitesService._(github); } class CheckRunsService extends Service { - CheckRunsService._(GitHub github) : super(github); + CheckRunsService._(super.github); /// Creates a new check run for a specific commit in a repository. /// Your GitHub App must have the `checks:write` permission to create check runs. @@ -235,7 +234,7 @@ class CheckRunsService extends Service { } class CheckSuitesService extends Service { - CheckSuitesService._(GitHub github) : super(github); + CheckSuitesService._(super.github); /// Gets a single check suite using its `id`. /// GitHub Apps must have the `checks:read` permission on a private repository or pull access to a public repository to get check suites. diff --git a/lib/src/common/gists_service.dart b/lib/src/common/gists_service.dart index 9078e03d..05ac62bd 100644 --- a/lib/src/common/gists_service.dart +++ b/lib/src/common/gists_service.dart @@ -8,7 +8,7 @@ import 'package:github/src/common.dart'; /// /// API docs: https://developer.github.com/v3/gists/ class GistsService extends Service { - GistsService(GitHub github) : super(github); + GistsService(super.github); /// lists gists for a user. /// diff --git a/lib/src/common/git_service.dart b/lib/src/common/git_service.dart index 7052e4f6..338dbeba 100644 --- a/lib/src/common/git_service.dart +++ b/lib/src/common/git_service.dart @@ -8,7 +8,7 @@ import 'package:github/src/common.dart'; /// /// API docs: https://developer.github.com/v3/git/blobs/ class GitService extends Service { - const GitService(GitHub github) : super(github); + const GitService(super.github); /// Fetches a blob from [slug] for a given [sha]. /// diff --git a/lib/src/common/issues_service.dart b/lib/src/common/issues_service.dart index 243c81dd..ed061846 100644 --- a/lib/src/common/issues_service.dart +++ b/lib/src/common/issues_service.dart @@ -8,7 +8,7 @@ import 'package:github/src/common.dart'; /// /// API docs: https://developer.github.com/v3/issues/ class IssuesService extends Service { - IssuesService(GitHub github) : super(github); + IssuesService(super.github); /// List all issues across all the authenticated user’s visible repositories /// including owned repositories, member repositories, and organization repositories diff --git a/lib/src/common/misc_service.dart b/lib/src/common/misc_service.dart index bb351f3d..30385a18 100644 --- a/lib/src/common/misc_service.dart +++ b/lib/src/common/misc_service.dart @@ -7,7 +7,7 @@ import 'package:github/src/common.dart'; /// /// API docs: https://developer.github.com/v3/misc/ class MiscService extends Service { - MiscService(GitHub github) : super(github); + MiscService(super.github); /// Fetches all emojis available on GitHub /// Returns a map of the name to a url of the image. diff --git a/lib/src/common/model/checks.dart b/lib/src/common/model/checks.dart index 9d7d6e21..5068febc 100644 --- a/lib/src/common/model/checks.dart +++ b/lib/src/common/model/checks.dart @@ -9,7 +9,7 @@ class CheckRunAnnotationLevel extends EnumWithValue { static const warning = CheckRunAnnotationLevel._('warning'); static const failure = CheckRunAnnotationLevel._('failure'); - const CheckRunAnnotationLevel._(String value) : super(value); + const CheckRunAnnotationLevel._(String super.value); factory CheckRunAnnotationLevel._fromValue(String? value) { switch (value) { @@ -51,7 +51,7 @@ class CheckRunConclusion extends EnumWithValue { static const actionRequired = CheckRunConclusion._('action_required'); static const empty = CheckRunConclusion._(null); - const CheckRunConclusion._(String? value) : super(value); + const CheckRunConclusion._(super.value); factory CheckRunConclusion._fromValue(String? value) { if (value == null) { @@ -79,13 +79,13 @@ class CheckRunStatus extends EnumWithValue { static const queued = CheckRunStatus._('queued'); static const inProgress = CheckRunStatus._('in_progress'); static const completed = CheckRunStatus._('completed'); - const CheckRunStatus._(String value) : super(value); + const CheckRunStatus._(String super.value); } class CheckRunFilter extends EnumWithValue { static const all = CheckRunFilter._('all'); static const latest = CheckRunFilter._('latest'); - const CheckRunFilter._(String value) : super(value); + const CheckRunFilter._(String super.value); } @immutable @@ -253,7 +253,7 @@ class CheckRunAnnotation { assert(title.length <= 255); @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { if (other is CheckRunAnnotation) { return other.annotationLevel == annotationLevel && other.path == path && diff --git a/lib/src/common/orgs_service.dart b/lib/src/common/orgs_service.dart index d793a8b9..b2ca7b26 100644 --- a/lib/src/common/orgs_service.dart +++ b/lib/src/common/orgs_service.dart @@ -9,7 +9,7 @@ import 'package:http/http.dart' as http; /// /// API docs: https://developer.github.com/v3/orgs/ class OrganizationsService extends Service { - OrganizationsService(GitHub github) : super(github); + OrganizationsService(super.github); /// Lists all of the memberships in organizations for the given [userName]. /// If [userName] is not specified we list the memberships in organizations diff --git a/lib/src/common/pulls_service.dart b/lib/src/common/pulls_service.dart index 5242f0e3..7fee2bf9 100644 --- a/lib/src/common/pulls_service.dart +++ b/lib/src/common/pulls_service.dart @@ -8,7 +8,7 @@ import 'package:github/src/common.dart'; /// /// API docs: https://developer.github.com/v3/pulls/ class PullRequestsService extends Service { - PullRequestsService(GitHub github) : super(github); + PullRequestsService(super.github); /// Fetches several pull requests. /// diff --git a/lib/src/common/repos_service.dart b/lib/src/common/repos_service.dart index a274710e..83fa5ef0 100644 --- a/lib/src/common/repos_service.dart +++ b/lib/src/common/repos_service.dart @@ -9,7 +9,7 @@ import 'package:http/http.dart' as http; /// /// API docs: https://developer.github.com/v3/repos/ class RepositoriesService extends Service { - RepositoriesService(GitHub github) : super(github); + RepositoriesService(super.github); /// Lists the repositories of the currently authenticated user. /// diff --git a/lib/src/common/search_service.dart b/lib/src/common/search_service.dart index bf2b41ec..27cf6eef 100644 --- a/lib/src/common/search_service.dart +++ b/lib/src/common/search_service.dart @@ -8,7 +8,7 @@ import 'package:github/src/common.dart'; /// /// API docs: https://developer.github.com/v3/search/ class SearchService extends Service { - SearchService(GitHub github) : super(github); + SearchService(super.github); /// Search for repositories using [query]. /// Since the Search Rate Limit is small, this is a best effort implementation. diff --git a/lib/src/common/url_shortener_service.dart b/lib/src/common/url_shortener_service.dart index 0b1e296f..60db2958 100644 --- a/lib/src/common/url_shortener_service.dart +++ b/lib/src/common/url_shortener_service.dart @@ -6,7 +6,7 @@ import 'package:github/src/common.dart'; /// /// API docs: https://github.com/blog/985-git-io-github-url-shortener class UrlShortenerService extends Service { - UrlShortenerService(GitHub github) : super(github); + UrlShortenerService(super.github); /// Shortens the provided [url]. An optional [code] can be provided to create /// your own vanity URL. diff --git a/lib/src/common/users_service.dart b/lib/src/common/users_service.dart index bb27ff6d..6485f4b0 100644 --- a/lib/src/common/users_service.dart +++ b/lib/src/common/users_service.dart @@ -8,7 +8,7 @@ import 'package:http/http.dart' as http; /// /// API docs: https://developer.github.com/v3/users/ class UsersService extends Service { - UsersService(GitHub github) : super(github); + UsersService(super.github); /// Fetches the user specified by [name]. /// diff --git a/lib/src/common/util/errors.dart b/lib/src/common/util/errors.dart index 81fa72b2..14625a6c 100644 --- a/lib/src/common/util/errors.dart +++ b/lib/src/common/util/errors.dart @@ -25,14 +25,13 @@ class NotReady extends GitHubError { /// GitHub Entity was not found class NotFound extends GitHubError { const NotFound( - GitHub github, - String msg, - ) : super(github, msg); + super.github, + String super.msg, + ); } class BadRequest extends GitHubError { - const BadRequest(GitHub github, [String? msg = 'Not Found']) - : super(github, msg); + const BadRequest(super.github, [super.msg = 'Not Found']); } /// GitHub Repository was not found @@ -94,11 +93,10 @@ class NotAuthenticated extends GitHubError { } class InvalidJSON extends BadRequest { - const InvalidJSON(GitHub github, [String? message = 'Invalid JSON']) - : super(github, message); + const InvalidJSON(super.github, [super.message = 'Invalid JSON']); } class ValidationFailed extends GitHubError { - const ValidationFailed(GitHub github, [String message = 'Validation Failed']) - : super(github, message); + const ValidationFailed(super.github, + [String super.message = 'Validation Failed']); } diff --git a/lib/src/common/util/utils.dart b/lib/src/common/util/utils.dart index 57bd6712..5c690774 100644 --- a/lib/src/common/util/utils.dart +++ b/lib/src/common/util/utils.dart @@ -21,7 +21,7 @@ abstract class EnumWithValue { /// True iff [other] is an [EnumWithValue] with the same value as this object. @override - bool operator ==(dynamic other) => + bool operator ==(Object other) => other is EnumWithValue && value == other.value; @override diff --git a/pubspec.yaml b/pubspec.yaml index af2ff765..308c3631 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,10 +1,10 @@ name: github -version: 9.22.0 +version: 9.23.0 description: A high-level GitHub API Client Library that uses Github's v3 API homepage: https://github.com/SpinlockLabs/github.dart environment: - sdk: '>=2.18.0 <3.0.0' + sdk: ^3.0.0 dependencies: http: '>=0.13.0 <2.0.0' @@ -19,10 +19,10 @@ dev_dependencies: collection: ^1.15.0 dependency_validator: json_serializable: ^6.6.1 - lints: ^2.0.0 + lints: ^3.0.0 mockito: ^5.0.0 nock: ^1.0.0 pub_semver: ^2.0.0 test: ^1.16.0 yaml: ^3.0.0 - yaml_edit: + yaml_edit: ^2.2.0 diff --git a/test/helper/http.dart b/test/helper/http.dart index 2c5eaab4..ffed40d4 100644 --- a/test/helper/http.dart +++ b/test/helper/http.dart @@ -25,8 +25,8 @@ class MockHTTPClient extends http.BaseClient { } class MockResponse extends http.Response { - MockResponse(String body, Map headers, int statusCode) - : super(body, statusCode, headers: headers); + MockResponse(super.body, Map headers, super.statusCode) + : super(headers: headers); factory MockResponse.fromAsset(String name) { final responseData = diff --git a/test/server/hooks_test_data.dart b/test/server/hooks_test_data.dart index 4f5b734b..ad02cc10 100644 --- a/test/server/hooks_test_data.dart +++ b/test/server/hooks_test_data.dart @@ -1,4 +1,5 @@ /// Json messages as dart string used for checks model tests. +library; String checkSuiteString = checkSuiteTemplate('requested'); diff --git a/tool/process_github_schema.dart b/tool/process_github_schema.dart index e3850df5..14994289 100644 --- a/tool/process_github_schema.dart +++ b/tool/process_github_schema.dart @@ -20,7 +20,7 @@ List wordWrap(String body) { typedef GenTypeVisitor = void Function(GenType type); -abstract class GenType extends Comparable { +abstract class GenType implements Comparable { GenType(); String get name; From f5a565f5d8389eccbde05744266be288f980785e Mon Sep 17 00:00:00 2001 From: Devon Carew Date: Mon, 26 Feb 2024 09:42:10 -0800 Subject: [PATCH 14/23] Fix Issue.isOpen and Issue.isClosed getters (#398) * Update issues.dart * require dart 3.0; update to the latest package:lints (#399) * require dart 3.0; update to the latest package:lints * update pubspec and changelog * update the pubspec version; add a changelog entry --- CHANGELOG.md | 4 ++++ lib/src/common/model/issues.dart | 4 ++-- pubspec.yaml | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ea5c0870..3f1f7db8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 9.24.0 + +* Bug fixes to the `Issue.isOpen` and `Issue.isClosed` getters. + ## 9.23.0 * Require Dart 3.0. diff --git a/lib/src/common/model/issues.dart b/lib/src/common/model/issues.dart index 12b40172..028552dd 100644 --- a/lib/src/common/model/issues.dart +++ b/lib/src/common/model/issues.dart @@ -103,8 +103,8 @@ class Issue { /// The user who closed the issue User? closedBy; - bool get isOpen => state == 'open'; - bool get isClosed => state == 'closed'; + bool get isOpen => state == 'OPEN'; + bool get isClosed => state == 'CLOSED'; // The following properties were added to support the Timeline API. diff --git a/pubspec.yaml b/pubspec.yaml index 308c3631..ab43b9e9 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: github -version: 9.23.0 +version: 9.24.0 description: A high-level GitHub API Client Library that uses Github's v3 API homepage: https://github.com/SpinlockLabs/github.dart From 816939826734db6c2be208a82bb3d67f8b28cbaa Mon Sep 17 00:00:00 2001 From: Kate Lovett Date: Sat, 13 Apr 2024 09:37:21 -0500 Subject: [PATCH 15/23] Fix case sensitivity in Issue.[isOpen, isClosed] (#402) Fixes https://github.com/SpinlockLabs/github.dart/issues/401 --- lib/src/common/model/issues.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/src/common/model/issues.dart b/lib/src/common/model/issues.dart index 028552dd..3d531e63 100644 --- a/lib/src/common/model/issues.dart +++ b/lib/src/common/model/issues.dart @@ -103,8 +103,8 @@ class Issue { /// The user who closed the issue User? closedBy; - bool get isOpen => state == 'OPEN'; - bool get isClosed => state == 'CLOSED'; + bool get isOpen => state.toUpperCase() == 'OPEN'; + bool get isClosed => state.toUpperCase() == 'CLOSED'; // The following properties were added to support the Timeline API. From d8af9b205c58bc3f1206fd7973bf762921be0e6d Mon Sep 17 00:00:00 2001 From: Kevin Moore Date: Mon, 14 Apr 2025 17:02:20 -0500 Subject: [PATCH 16/23] Update some dependencies, bump min SDK (#415) --- .github/workflows/dart.yml | 2 +- CHANGELOG.md | 5 +++++ analysis_options.yaml | 1 - pubspec.yaml | 26 +++++++++++++------------- test/scenarios_test.dart | 1 + 5 files changed, 20 insertions(+), 15 deletions(-) diff --git a/.github/workflows/dart.yml b/.github/workflows/dart.yml index 2d725e23..1dcc0100 100644 --- a/.github/workflows/dart.yml +++ b/.github/workflows/dart.yml @@ -13,7 +13,7 @@ jobs: matrix: os: [ubuntu-latest] # Test with at least the declared minimum Dart version - sdk: ['3.0', stable] + sdk: ['3.1', stable] steps: - uses: actions/checkout@v4 - uses: dart-lang/setup-dart@v1 diff --git a/CHANGELOG.md b/CHANGELOG.md index 3f1f7db8..7939058a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 9.25.0-wip + +* Require Dart 3.1 +* Require `package:http` `^1.0.0`. + ## 9.24.0 * Bug fixes to the `Issue.isOpen` and `Issue.isClosed` getters. diff --git a/analysis_options.yaml b/analysis_options.yaml index 1af8628e..f2974469 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -31,7 +31,6 @@ linter: - omit_local_variable_types - one_member_abstracts - only_throw_errors - - package_api_docs - prefer_asserts_in_initializer_lists - prefer_const_constructors - prefer_const_constructors_in_immutables diff --git a/pubspec.yaml b/pubspec.yaml index ab43b9e9..e86ed709 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,28 +1,28 @@ name: github -version: 9.24.0 +version: 9.25.0-wip description: A high-level GitHub API Client Library that uses Github's v3 API homepage: https://github.com/SpinlockLabs/github.dart environment: - sdk: ^3.0.0 + sdk: ^3.1.0 dependencies: - http: '>=0.13.0 <2.0.0' + http: ^1.0.0 http_parser: ^4.0.0 json_annotation: ^4.8.0 - meta: ^1.3.0 + meta: ^1.7.0 dev_dependencies: - build_runner: any - build_test: any - build_web_compilers: any + build_runner: ^2.2.1 + build_test: ^2.1.2 + build_web_compilers: ^3.2.6 collection: ^1.15.0 - dependency_validator: + dependency_validator: ^3.0.0 json_serializable: ^6.6.1 - lints: ^3.0.0 - mockito: ^5.0.0 - nock: ^1.0.0 + lints: ^4.0.0 + mockito: ^5.3.2 + nock: ^1.1.3 pub_semver: ^2.0.0 - test: ^1.16.0 - yaml: ^3.0.0 + test: ^1.21.6 + yaml: ^3.1.0 yaml_edit: ^2.2.0 diff --git a/test/scenarios_test.dart b/test/scenarios_test.dart index 70f1a789..fb453845 100644 --- a/test/scenarios_test.dart +++ b/test/scenarios_test.dart @@ -2,6 +2,7 @@ @Tags(['scenarios']) @TestOn('vm') +library; import 'dart:convert'; From edc3f5ae9210e882e692a8cb1e3a0f989eb9aaad Mon Sep 17 00:00:00 2001 From: Rob Becker Date: Mon, 14 Apr 2025 16:19:40 -0600 Subject: [PATCH 17/23] Update json_annotation min and build_web_compilers range --- pubspec.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pubspec.yaml b/pubspec.yaml index e86ed709..9b29ea72 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -9,13 +9,13 @@ environment: dependencies: http: ^1.0.0 http_parser: ^4.0.0 - json_annotation: ^4.8.0 + json_annotation: ^4.9.0 meta: ^1.7.0 dev_dependencies: build_runner: ^2.2.1 build_test: ^2.1.2 - build_web_compilers: ^3.2.6 + build_web_compilers: '>=3.2.6 < 5.0.0' collection: ^1.15.0 dependency_validator: ^3.0.0 json_serializable: ^6.6.1 From 4926022d04082ea72bb74582b31c3b80bd3165d9 Mon Sep 17 00:00:00 2001 From: Kevin Moore Date: Mon, 14 Apr 2025 17:21:03 -0500 Subject: [PATCH 18/23] Rebuild JSON bits (#416) Co-authored-by: Rob Becker --- lib/src/common/model/authorizations.g.dart | 2 +- lib/src/common/model/gists.g.dart | 14 +++--- lib/src/common/model/git.g.dart | 6 +-- lib/src/common/model/issues.g.dart | 18 +++---- lib/src/common/model/keys.g.dart | 2 +- lib/src/common/model/misc.g.dart | 4 +- lib/src/common/model/orgs.g.dart | 18 +++---- lib/src/common/model/pulls.g.dart | 52 ++++++++++---------- lib/src/common/model/reaction.g.dart | 20 ++++---- lib/src/common/model/repos.g.dart | 36 +++++++------- lib/src/common/model/repos_commits.g.dart | 18 +++---- lib/src/common/model/repos_contents.g.dart | 2 +- lib/src/common/model/repos_hooks.g.dart | 2 +- lib/src/common/model/repos_pages.g.dart | 4 +- lib/src/common/model/repos_releases.g.dart | 8 +-- lib/src/common/model/repos_stats.g.dart | 38 ++++++++------ lib/src/common/model/repos_statuses.g.dart | 2 +- lib/src/common/model/search.g.dart | 2 +- lib/src/common/model/timeline.g.dart | 32 ++++++------ lib/src/common/model/timeline_support.g.dart | 28 +++++------ lib/src/common/model/users.g.dart | 38 +++++++------- lib/src/server/hooks.g.dart | 2 +- 22 files changed, 177 insertions(+), 171 deletions(-) diff --git a/lib/src/common/model/authorizations.g.dart b/lib/src/common/model/authorizations.g.dart index 7c3a2e73..918a8a47 100644 --- a/lib/src/common/model/authorizations.g.dart +++ b/lib/src/common/model/authorizations.g.dart @@ -8,7 +8,7 @@ part of 'authorizations.dart'; Authorization _$AuthorizationFromJson(Map json) => Authorization( - id: json['id'] as int?, + id: (json['id'] as num?)?.toInt(), scopes: (json['scopes'] as List?)?.map((e) => e as String).toList(), token: json['token'] as String?, diff --git a/lib/src/common/model/gists.g.dart b/lib/src/common/model/gists.g.dart index e1d6db23..3438e5ea 100644 --- a/lib/src/common/model/gists.g.dart +++ b/lib/src/common/model/gists.g.dart @@ -20,7 +20,7 @@ Gist _$GistFromJson(Map json) => Gist( (k, e) => MapEntry(k, GistFile.fromJson(e as Map)), ), htmlUrl: json['html_url'] as String?, - commentsCount: json['comments'] as int?, + commentsCount: (json['comments'] as num?)?.toInt(), gitPullUrl: json['git_pull_url'] as String?, gitPushUrl: json['git_push_url'] as String?, createdAt: json['created_at'] == null @@ -48,7 +48,7 @@ Map _$GistToJson(Gist instance) => { GistFile _$GistFileFromJson(Map json) => GistFile( filename: json['filename'] as String?, - size: json['size'] as int?, + size: (json['size'] as num?)?.toInt(), rawUrl: json['raw_url'] as String?, type: json['type'] as String?, language: json['language'] as String?, @@ -70,7 +70,7 @@ GistFork _$GistForkFromJson(Map json) => GistFork( user: json['user'] == null ? null : User.fromJson(json['user'] as Map), - id: json['id'] as int?, + id: (json['id'] as num?)?.toInt(), createdAt: json['created_at'] == null ? null : DateTime.parse(json['created_at'] as String), @@ -92,9 +92,9 @@ GistHistoryEntry _$GistHistoryEntryFromJson(Map json) => user: json['user'] == null ? null : User.fromJson(json['user'] as Map), - deletions: json['change_status/deletions'] as int?, - additions: json['change_status/additions'] as int?, - totalChanges: json['change_status/total'] as int?, + deletions: (json['change_status/deletions'] as num?)?.toInt(), + additions: (json['change_status/additions'] as num?)?.toInt(), + totalChanges: (json['change_status/total'] as num?)?.toInt(), committedAt: json['committed_at'] == null ? null : DateTime.parse(json['committed_at'] as String), @@ -111,7 +111,7 @@ Map _$GistHistoryEntryToJson(GistHistoryEntry instance) => }; GistComment _$GistCommentFromJson(Map json) => GistComment( - id: json['id'] as int?, + id: (json['id'] as num?)?.toInt(), user: json['user'] == null ? null : User.fromJson(json['user'] as Map), diff --git a/lib/src/common/model/git.g.dart b/lib/src/common/model/git.g.dart index 61d5fc44..e041aeb3 100644 --- a/lib/src/common/model/git.g.dart +++ b/lib/src/common/model/git.g.dart @@ -11,7 +11,7 @@ GitBlob _$GitBlobFromJson(Map json) => GitBlob( encoding: json['encoding'] as String?, url: json['url'] as String?, sha: json['sha'] as String?, - size: json['size'] as int?, + size: (json['size'] as num?)?.toInt(), ); Map _$GitBlobToJson(GitBlob instance) => { @@ -50,7 +50,7 @@ GitCommit _$GitCommitFromJson(Map json) => GitCommit( parents: (json['parents'] as List?) ?.map((e) => GitCommit.fromJson(e as Map)) .toList(), - commentCount: json['comment_count'] as int?, + commentCount: (json['comment_count'] as num?)?.toInt(), ); Map _$GitCommitToJson(GitCommit instance) => { @@ -130,7 +130,7 @@ GitTreeEntry _$GitTreeEntryFromJson(Map json) => GitTreeEntry( json['path'] as String?, json['mode'] as String?, json['type'] as String?, - json['size'] as int?, + (json['size'] as num?)?.toInt(), json['sha'] as String?, json['url'] as String?, ); diff --git a/lib/src/common/model/issues.g.dart b/lib/src/common/model/issues.g.dart index 40bbfa94..e4a80082 100644 --- a/lib/src/common/model/issues.g.dart +++ b/lib/src/common/model/issues.g.dart @@ -7,10 +7,10 @@ part of 'issues.dart'; // ************************************************************************** Issue _$IssueFromJson(Map json) => Issue( - id: json['id'] as int? ?? 0, + id: (json['id'] as num?)?.toInt() ?? 0, url: json['url'] as String? ?? '', htmlUrl: json['html_url'] as String? ?? '', - number: json['number'] as int? ?? 0, + number: (json['number'] as num?)?.toInt() ?? 0, state: json['state'] as String? ?? '', title: json['title'] as String? ?? '', user: json['user'] == null @@ -29,7 +29,7 @@ Issue _$IssueFromJson(Map json) => Issue( milestone: json['milestone'] == null ? null : Milestone.fromJson(json['milestone'] as Map), - commentsCount: json['comments'] as int? ?? 0, + commentsCount: (json['comments'] as num?)?.toInt() ?? 0, pullRequest: json['pull_request'] == null ? null : IssuePullRequest.fromJson( @@ -119,7 +119,7 @@ IssueRequest _$IssueRequestFromJson(Map json) => IssueRequest( ?.map((e) => e as String) .toList(), state: json['state'] as String?, - milestone: json['milestone'] as int?, + milestone: (json['milestone'] as num?)?.toInt(), ); Map _$IssueRequestToJson(IssueRequest instance) => @@ -148,7 +148,7 @@ Map _$IssuePullRequestToJson(IssuePullRequest instance) => }; IssueComment _$IssueCommentFromJson(Map json) => IssueComment( - id: json['id'] as int?, + id: (json['id'] as num?)?.toInt(), body: json['body'] as String?, user: json['user'] == null ? null @@ -192,16 +192,16 @@ Map _$IssueLabelToJson(IssueLabel instance) => }; Milestone _$MilestoneFromJson(Map json) => Milestone( - id: json['id'] as int?, - number: json['number'] as int?, + id: (json['id'] as num?)?.toInt(), + number: (json['number'] as num?)?.toInt(), state: json['state'] as String?, title: json['title'] as String?, description: json['description'] as String?, creator: json['creator'] == null ? null : User.fromJson(json['creator'] as Map), - openIssuesCount: json['open_issues'] as int?, - closedIssuesCount: json['closed_issues'] as int?, + openIssuesCount: (json['open_issues'] as num?)?.toInt(), + closedIssuesCount: (json['closed_issues'] as num?)?.toInt(), createdAt: json['created_at'] == null ? null : DateTime.parse(json['created_at'] as String), diff --git a/lib/src/common/model/keys.g.dart b/lib/src/common/model/keys.g.dart index 1db24c87..7cecbcf2 100644 --- a/lib/src/common/model/keys.g.dart +++ b/lib/src/common/model/keys.g.dart @@ -7,7 +7,7 @@ part of 'keys.dart'; // ************************************************************************** PublicKey _$PublicKeyFromJson(Map json) => PublicKey( - id: json['id'] as int?, + id: (json['id'] as num?)?.toInt(), key: json['key'] as String?, title: json['title'] as String?, ); diff --git a/lib/src/common/model/misc.g.dart b/lib/src/common/model/misc.g.dart index d7b3896c..4ad9a310 100644 --- a/lib/src/common/model/misc.g.dart +++ b/lib/src/common/model/misc.g.dart @@ -19,8 +19,8 @@ Map _$GitignoreTemplateToJson(GitignoreTemplate instance) => }; RateLimit _$RateLimitFromJson(Map json) => RateLimit( - json['limit'] as int?, - json['remaining'] as int?, + (json['limit'] as num?)?.toInt(), + (json['remaining'] as num?)?.toInt(), json['resets'] == null ? null : DateTime.parse(json['resets'] as String), ); diff --git a/lib/src/common/model/orgs.g.dart b/lib/src/common/model/orgs.g.dart index c32f6702..dc9dc349 100644 --- a/lib/src/common/model/orgs.g.dart +++ b/lib/src/common/model/orgs.g.dart @@ -8,7 +8,7 @@ part of 'orgs.dart'; Organization _$OrganizationFromJson(Map json) => Organization( login: json['login'] as String?, - id: json['id'] as int?, + id: (json['id'] as num?)?.toInt(), htmlUrl: json['html_url'] as String?, avatarUrl: json['avatar_url'] as String?, name: json['name'] as String?, @@ -16,10 +16,10 @@ Organization _$OrganizationFromJson(Map json) => Organization( blog: json['blog'] as String?, location: json['location'] as String?, email: json['email'] as String?, - publicReposCount: json['public_repos'] as int?, - publicGistsCount: json['public_gists'] as int?, - followersCount: json['followers'] as int?, - followingCount: json['following'] as int?, + publicReposCount: (json['public_repos'] as num?)?.toInt(), + publicGistsCount: (json['public_gists'] as num?)?.toInt(), + followersCount: (json['followers'] as num?)?.toInt(), + followingCount: (json['following'] as num?)?.toInt(), createdAt: json['created_at'] == null ? null : DateTime.parse(json['created_at'] as String), @@ -66,9 +66,9 @@ Map _$OrganizationMembershipToJson( Team _$TeamFromJson(Map json) => Team( description: json['description'] as String?, htmlUrl: json['html_url'] as String?, - id: json['id'] as int?, + id: (json['id'] as num?)?.toInt(), ldapDn: json['ldap_dn'] as String?, - membersCount: json['members_count'] as int?, + membersCount: (json['members_count'] as num?)?.toInt(), membersUrl: json['members_url'] as String?, name: json['name'] as String?, nodeId: json['node_id'] as String?, @@ -83,7 +83,7 @@ Team _$TeamFromJson(Map json) => Team( ? null : Permissions.fromJson(json['permissions'] as Map), privacy: json['privacy'] as String?, - reposCount: json['repos_count'] as int?, + reposCount: (json['repos_count'] as num?)?.toInt(), repositoriesUrl: json['repositories_url'] as String?, slug: json['slug'] as String?, url: json['url'] as String?, @@ -128,7 +128,7 @@ Map _$PermissionsToJson(Permissions instance) => TeamMember _$TeamMemberFromJson(Map json) => TeamMember( login: json['login'] as String?, - id: json['id'] as int?, + id: (json['id'] as num?)?.toInt(), avatarUrl: json['avatar_url'] as String?, type: json['type'] as String?, siteAdmin: json['site_admin'] as bool?, diff --git a/lib/src/common/model/pulls.g.dart b/lib/src/common/model/pulls.g.dart index cf370e22..e7dea0cb 100644 --- a/lib/src/common/model/pulls.g.dart +++ b/lib/src/common/model/pulls.g.dart @@ -7,12 +7,12 @@ part of 'pulls.dart'; // ************************************************************************** PullRequest _$PullRequestFromJson(Map json) => PullRequest( - id: json['id'] as int?, + id: (json['id'] as num?)?.toInt(), nodeId: json['node_id'] as String?, htmlUrl: json['html_url'] as String?, diffUrl: json['diff_url'] as String?, patchUrl: json['patch_url'] as String?, - number: json['number'] as int?, + number: (json['number'] as num?)?.toInt(), state: json['state'] as String?, title: json['title'] as String?, body: json['body'] as String?, @@ -44,18 +44,18 @@ PullRequest _$PullRequestFromJson(Map json) => PullRequest( mergedBy: json['merged_by'] == null ? null : User.fromJson(json['merged_by'] as Map), - commentsCount: json['comments'] as int? ?? 0, - commitsCount: json['commits'] as int? ?? 0, - additionsCount: json['additions'] as int? ?? 0, - deletionsCount: json['deletions'] as int? ?? 0, - changedFilesCount: json['changed_files'] as int? ?? 0, + commentsCount: (json['comments'] as num?)?.toInt() ?? 0, + commitsCount: (json['commits'] as num?)?.toInt() ?? 0, + additionsCount: (json['additions'] as num?)?.toInt() ?? 0, + deletionsCount: (json['deletions'] as num?)?.toInt() ?? 0, + changedFilesCount: (json['changed_files'] as num?)?.toInt() ?? 0, labels: (json['labels'] as List?) ?.map((e) => IssueLabel.fromJson(e as Map)) .toList(), requestedReviewers: (json['requested_reviewers'] as List?) ?.map((e) => User.fromJson(e as Map)) .toList(), - reviewCommentCount: json['review_comments'] as int? ?? 0, + reviewCommentCount: (json['review_comments'] as num?)?.toInt() ?? 0, milestone: json['milestone'] == null ? null : Milestone.fromJson(json['milestone'] as Map), @@ -162,11 +162,11 @@ Map _$CreatePullRequestToJson(CreatePullRequest instance) => PullRequestComment _$PullRequestCommentFromJson(Map json) => PullRequestComment( - id: json['id'] as int?, + id: (json['id'] as num?)?.toInt(), diffHunk: json['diff_hunk'] as String?, path: json['path'] as String?, - position: json['position'] as int?, - originalPosition: json['original_position'] as int?, + position: (json['position'] as num?)?.toInt(), + originalPosition: (json['original_position'] as num?)?.toInt(), commitId: json['commit_id'] as String?, originalCommitId: json['original_commit_id'] as String?, user: json['user'] == null @@ -210,7 +210,7 @@ CreatePullRequestComment _$CreatePullRequestCommentFromJson( json['body'] as String?, json['commit_id'] as String?, json['path'] as String?, - json['position'] as int?, + (json['position'] as num?)?.toInt(), ); Map _$CreatePullRequestCommentToJson( @@ -227,9 +227,9 @@ PullRequestFile _$PullRequestFileFromJson(Map json) => sha: json['sha'] as String?, filename: json['filename'] as String?, status: json['status'] as String?, - additionsCount: json['additions'] as int?, - deletionsCount: json['deletions'] as int?, - changesCount: json['changes'] as int?, + additionsCount: (json['additions'] as num?)?.toInt(), + deletionsCount: (json['deletions'] as num?)?.toInt(), + changesCount: (json['changes'] as num?)?.toInt(), blobUrl: json['blob_url'] as String?, rawUrl: json['raw_url'] as String?, contentsUrl: json['contents_url'] as String?, @@ -252,7 +252,7 @@ Map _$PullRequestFileToJson(PullRequestFile instance) => PullRequestReview _$PullRequestReviewFromJson(Map json) => PullRequestReview( - id: json['id'] as int, + id: (json['id'] as num).toInt(), user: json['user'] == null ? null : User.fromJson(json['user'] as Map), @@ -285,7 +285,7 @@ CreatePullRequestReview _$CreatePullRequestReviewFromJson( CreatePullRequestReview( json['owner'] as String, json['repo'] as String, - json['pull_number'] as int, + (json['pull_number'] as num).toInt(), json['event'] as String, body: json['body'] as String?, comments: (json['comments'] as List?) @@ -318,26 +318,26 @@ PullRequestReviewComment _$PullRequestReviewCommentFromJson( : DateTime.parse(json['created_at'] as String), diffHunk: json['diff_hunk'] as String?, htmlUrl: json['html_url'] as String?, - id: json['id'] as int?, - inReplyToId: json['in_reply_to_id'] as int?, - line: json['line'] as int?, + id: (json['id'] as num?)?.toInt(), + inReplyToId: (json['in_reply_to_id'] as num?)?.toInt(), + line: (json['line'] as num?)?.toInt(), links: json['_links'] == null ? null : ReviewLinks.fromJson(json['_links'] as Map), nodeId: json['node_id'] as String?, originalCommitId: json['original_commit_id'] as String?, - originalLine: json['original_line'] as int?, - originalPosition: json['original_position'] as int?, - originalStartLine: json['original_start_line'] as int?, + originalLine: (json['original_line'] as num?)?.toInt(), + originalPosition: (json['original_position'] as num?)?.toInt(), + originalStartLine: (json['original_start_line'] as num?)?.toInt(), path: json['path'] as String?, - position: json['position'] as int?, - pullRequestReviewId: json['pull_request_review_id'] as int?, + position: (json['position'] as num?)?.toInt(), + pullRequestReviewId: (json['pull_request_review_id'] as num?)?.toInt(), pullRequestUrl: json['pull_request_url'] as String?, reactions: json['reactions'] == null ? null : ReactionRollup.fromJson(json['reactions'] as Map), side: json['side'] as String?, - startLine: json['start_line'] as int?, + startLine: (json['start_line'] as num?)?.toInt(), startSide: json['start_side'] as String?, subjectType: json['subject_type'] as String?, updatedAt: json['updated_at'] == null diff --git a/lib/src/common/model/reaction.g.dart b/lib/src/common/model/reaction.g.dart index d94eede4..4647e160 100644 --- a/lib/src/common/model/reaction.g.dart +++ b/lib/src/common/model/reaction.g.dart @@ -7,7 +7,7 @@ part of 'reaction.dart'; // ************************************************************************** Reaction _$ReactionFromJson(Map json) => Reaction( - id: json['id'] as int?, + id: (json['id'] as num?)?.toInt(), nodeId: json['node_id'] as String?, user: json['user'] == null ? null @@ -28,15 +28,15 @@ Map _$ReactionToJson(Reaction instance) => { ReactionRollup _$ReactionRollupFromJson(Map json) => ReactionRollup( - plusOne: json['+1'] as int?, - minusOne: json['-1'] as int?, - confused: json['confused'] as int?, - eyes: json['eyes'] as int?, - heart: json['heart'] as int?, - hooray: json['hooray'] as int?, - laugh: json['laugh'] as int?, - rocket: json['rocket'] as int?, - totalCount: json['total_count'] as int?, + plusOne: (json['+1'] as num?)?.toInt(), + minusOne: (json['-1'] as num?)?.toInt(), + confused: (json['confused'] as num?)?.toInt(), + eyes: (json['eyes'] as num?)?.toInt(), + heart: (json['heart'] as num?)?.toInt(), + hooray: (json['hooray'] as num?)?.toInt(), + laugh: (json['laugh'] as num?)?.toInt(), + rocket: (json['rocket'] as num?)?.toInt(), + totalCount: (json['total_count'] as num?)?.toInt(), url: json['url'] as String?, ); diff --git a/lib/src/common/model/repos.g.dart b/lib/src/common/model/repos.g.dart index 490b18b1..fe19ea97 100644 --- a/lib/src/common/model/repos.g.dart +++ b/lib/src/common/model/repos.g.dart @@ -10,9 +10,9 @@ GitHubComparison _$GitHubComparisonFromJson(Map json) => GitHubComparison( json['url'] as String?, json['status'] as String?, - json['ahead_by'] as int?, - json['behind_by'] as int?, - json['total_commits'] as int?, + (json['ahead_by'] as num?)?.toInt(), + (json['behind_by'] as num?)?.toInt(), + (json['total_commits'] as num?)?.toInt(), (json['files'] as List?) ?.map((e) => CommitFile.fromJson(e as Map)) .toList(), @@ -34,7 +34,7 @@ Map _$GitHubComparisonToJson(GitHubComparison instance) => Repository _$RepositoryFromJson(Map json) => Repository( name: json['name'] as String? ?? '', - id: json['id'] as int? ?? 0, + id: (json['id'] as num?)?.toInt() ?? 0, fullName: json['full_name'] as String? ?? '', owner: json['owner'] == null ? null @@ -51,17 +51,17 @@ Repository _$RepositoryFromJson(Map json) => Repository( : DateTime.parse(json['created_at'] as String), isPrivate: json['private'] as bool? ?? false, isFork: json['fork'] as bool? ?? false, - stargazersCount: json['stargazers_count'] as int? ?? 0, - watchersCount: json['watchers_count'] as int? ?? 0, + stargazersCount: (json['stargazers_count'] as num?)?.toInt() ?? 0, + watchersCount: (json['watchers_count'] as num?)?.toInt() ?? 0, language: json['language'] as String? ?? '', hasWiki: json['has_wiki'] as bool? ?? false, hasDownloads: json['has_downloads'] as bool? ?? false, - forksCount: json['forks_count'] as int? ?? 0, - openIssuesCount: json['open_issues_count'] as int? ?? 0, - subscribersCount: json['subscribers_count'] as int? ?? 0, - networkCount: json['network_count'] as int? ?? 0, + forksCount: (json['forks_count'] as num?)?.toInt() ?? 0, + openIssuesCount: (json['open_issues_count'] as num?)?.toInt() ?? 0, + subscribersCount: (json['subscribers_count'] as num?)?.toInt() ?? 0, + networkCount: (json['network_count'] as num?)?.toInt() ?? 0, hasIssues: json['has_issues'] as bool? ?? false, - size: json['size'] as int? ?? 0, + size: (json['size'] as num?)?.toInt() ?? 0, archived: json['archived'] as bool? ?? false, disabled: json['disabled'] as bool? ?? false, homepage: json['homepage'] as String? ?? '', @@ -100,7 +100,7 @@ Repository _$RepositoryFromJson(Map json) => Repository( deploymentsUrl: json['deployments_url'] as String?, downloadsUrl: json['downloads_url'] as String?, eventsUrl: json['events_url'] as String?, - forks: json['forks'] as int?, + forks: (json['forks'] as num?)?.toInt(), forksUrl: json['forks_url'] as String?, gitCommitsUrl: json['git_commits_url'] as String?, gitRefsUrl: json['git_refs_url'] as String?, @@ -123,7 +123,7 @@ Repository _$RepositoryFromJson(Map json) => Repository( mirrorUrl: json['mirror_url'] as String?, nodeId: json['node_id'] as String?, notificationsUrl: json['notifications_url'] as String?, - openIssues: json['open_issues'] as int?, + openIssues: (json['open_issues'] as num?)?.toInt(), organization: json['organization'] == null ? null : User.fromJson(json['organization'] as Map), @@ -150,7 +150,7 @@ Repository _$RepositoryFromJson(Map json) => Repository( treesUrl: json['trees_url'] as String?, url: json['url'] as String?, visibility: json['visibility'] as String?, - watchers: json['watchers'] as int?, + watchers: (json['watchers'] as num?)?.toInt(), webCommitSignoffRequired: json['web_commit_signoff_required'] as bool?, ); @@ -320,7 +320,7 @@ Map _$CommitDataToJson(CommitData instance) => CommitDataUser _$CommitDataUserFromJson(Map json) => CommitDataUser( json['login'] as String?, - json['id'] as int?, + (json['id'] as num?)?.toInt(), json['type'] as String?, ); @@ -347,7 +347,7 @@ Map _$CommitInfoToJson(CommitInfo instance) => UserInformation _$UserInformationFromJson(Map json) => UserInformation( json['login'] as String, - json['id'] as int, + (json['id'] as num).toInt(), json['avatar_url'] as String, json['html_url'] as String, ); @@ -380,7 +380,7 @@ CreateRepository _$CreateRepositoryFromJson(Map json) => private: json['private'] as bool?, hasIssues: json['has_issues'] as bool?, hasDownloads: json['has_downloads'] as bool?, - teamId: json['team_id'] as int?, + teamId: (json['team_id'] as num?)?.toInt(), autoInit: json['auto_init'] as bool?, gitignoreTemplate: json['gitignore_template'] as String?, licenseTemplate: json['license_template'] as String?, @@ -419,7 +419,7 @@ LicenseDetails _$LicenseDetailsFromJson(Map json) => name: json['name'] as String?, path: json['path'] as String?, sha: json['sha'] as String?, - size: json['size'] as int?, + size: (json['size'] as num?)?.toInt(), url: json['url'] == null ? null : Uri.parse(json['url'] as String), htmlUrl: json['html_url'] == null ? null diff --git a/lib/src/common/model/repos_commits.g.dart b/lib/src/common/model/repos_commits.g.dart index 5e74c999..a4b3a5fe 100644 --- a/lib/src/common/model/repos_commits.g.dart +++ b/lib/src/common/model/repos_commits.g.dart @@ -47,9 +47,9 @@ Map _$RepositoryCommitToJson(RepositoryCommit instance) => }; CommitStats _$CommitStatsFromJson(Map json) => CommitStats( - additions: json['additions'] as int?, - deletions: json['deletions'] as int?, - total: json['total'] as int?, + additions: (json['additions'] as num?)?.toInt(), + deletions: (json['deletions'] as num?)?.toInt(), + total: (json['total'] as num?)?.toInt(), ); Map _$CommitStatsToJson(CommitStats instance) => @@ -61,9 +61,9 @@ Map _$CommitStatsToJson(CommitStats instance) => CommitFile _$CommitFileFromJson(Map json) => CommitFile( name: json['filename'] as String?, - additions: json['additions'] as int?, - deletions: json['deletions'] as int?, - changes: json['changes'] as int?, + additions: (json['additions'] as num?)?.toInt(), + deletions: (json['deletions'] as num?)?.toInt(), + changes: (json['changes'] as num?)?.toInt(), status: json['status'] as String?, rawUrl: json['raw_url'] as String?, blobUrl: json['blob_url'] as String?, @@ -84,9 +84,9 @@ Map _$CommitFileToJson(CommitFile instance) => CommitComment _$CommitCommentFromJson(Map json) => CommitComment( - id: json['id'] as int?, - line: json['line'] as int?, - position: json['position'] as int?, + id: (json['id'] as num?)?.toInt(), + line: (json['line'] as num?)?.toInt(), + position: (json['position'] as num?)?.toInt(), path: json['path'] as String?, apiUrl: json['url'] as String?, commitId: json['commit_id'] as String?, diff --git a/lib/src/common/model/repos_contents.g.dart b/lib/src/common/model/repos_contents.g.dart index 96f92749..84dc677b 100644 --- a/lib/src/common/model/repos_contents.g.dart +++ b/lib/src/common/model/repos_contents.g.dart @@ -9,7 +9,7 @@ part of 'repos_contents.dart'; GitHubFile _$GitHubFileFromJson(Map json) => GitHubFile( type: json['type'] as String?, encoding: json['encoding'] as String?, - size: json['size'] as int?, + size: (json['size'] as num?)?.toInt(), name: json['name'] as String?, path: json['path'] as String?, content: json['content'] as String?, diff --git a/lib/src/common/model/repos_hooks.g.dart b/lib/src/common/model/repos_hooks.g.dart index c199f2ea..fa57fa4f 100644 --- a/lib/src/common/model/repos_hooks.g.dart +++ b/lib/src/common/model/repos_hooks.g.dart @@ -7,7 +7,7 @@ part of 'repos_hooks.dart'; // ************************************************************************** Hook _$HookFromJson(Map json) => Hook( - id: json['id'] as int?, + id: (json['id'] as num?)?.toInt(), name: json['name'] as String?, ) ..events = diff --git a/lib/src/common/model/repos_pages.g.dart b/lib/src/common/model/repos_pages.g.dart index a550ad75..ead9a68f 100644 --- a/lib/src/common/model/repos_pages.g.dart +++ b/lib/src/common/model/repos_pages.g.dart @@ -30,7 +30,7 @@ PageBuild _$PageBuildFromJson(Map json) => PageBuild( ? null : PageBuildPusher.fromJson(json['pusher'] as Map), commit: json['commit'] as String?, - duration: json['duration'] as int?, + duration: (json['duration'] as num?)?.toInt(), createdAt: json['created_at'] == null ? null : DateTime.parse(json['created_at'] as String), @@ -53,7 +53,7 @@ Map _$PageBuildToJson(PageBuild instance) => { PageBuildPusher _$PageBuildPusherFromJson(Map json) => PageBuildPusher( login: json['login'] as String?, - id: json['id'] as int?, + id: (json['id'] as num?)?.toInt(), apiUrl: json['url'] as String?, htmlUrl: json['html_url'] as String?, type: json['type'] as String?, diff --git a/lib/src/common/model/repos_releases.g.dart b/lib/src/common/model/repos_releases.g.dart index 2e0998e7..e0596897 100644 --- a/lib/src/common/model/repos_releases.g.dart +++ b/lib/src/common/model/repos_releases.g.dart @@ -7,7 +7,7 @@ part of 'repos_releases.dart'; // ************************************************************************** Release _$ReleaseFromJson(Map json) => Release( - id: json['id'] as int?, + id: (json['id'] as num?)?.toInt(), url: json['url'] as String?, htmlUrl: json['html_url'] as String?, tarballUrl: json['tarball_url'] as String?, @@ -61,13 +61,13 @@ Map _$ReleaseToJson(Release instance) => { }; ReleaseAsset _$ReleaseAssetFromJson(Map json) => ReleaseAsset( - id: json['id'] as int?, + id: (json['id'] as num?)?.toInt(), name: json['name'] as String?, label: json['label'] as String?, state: json['state'] as String?, contentType: json['content_type'] as String?, - size: json['size'] as int?, - downloadCount: json['download_count'] as int?, + size: (json['size'] as num?)?.toInt(), + downloadCount: (json['download_count'] as num?)?.toInt(), browserDownloadUrl: json['browser_download_url'] as String?, createdAt: json['created_at'] == null ? null diff --git a/lib/src/common/model/repos_stats.g.dart b/lib/src/common/model/repos_stats.g.dart index 12a609a5..83bd1650 100644 --- a/lib/src/common/model/repos_stats.g.dart +++ b/lib/src/common/model/repos_stats.g.dart @@ -12,7 +12,7 @@ ContributorStatistics _$ContributorStatisticsFromJson( json['author'] == null ? null : User.fromJson(json['author'] as Map), - json['total'] as int?, + (json['total'] as num?)?.toInt(), (json['weeks'] as List?) ?.map((e) => ContributorWeekStatistics.fromJson(e as Map)) @@ -30,10 +30,10 @@ Map _$ContributorStatisticsToJson( ContributorWeekStatistics _$ContributorWeekStatisticsFromJson( Map json) => ContributorWeekStatistics( - json['w'] as int?, - json['a'] as int?, - json['d'] as int?, - json['c'] as int?, + (json['w'] as num?)?.toInt(), + (json['a'] as num?)?.toInt(), + (json['d'] as num?)?.toInt(), + (json['c'] as num?)?.toInt(), ); Map _$ContributorWeekStatisticsToJson( @@ -48,8 +48,12 @@ Map _$ContributorWeekStatisticsToJson( ContributorParticipation _$ContributorParticipationFromJson( Map json) => ContributorParticipation( - all: (json['all'] as List?)?.map((e) => e as int).toList(), - owner: (json['owner'] as List?)?.map((e) => e as int).toList(), + all: (json['all'] as List?) + ?.map((e) => (e as num).toInt()) + .toList(), + owner: (json['owner'] as List?) + ?.map((e) => (e as num).toInt()) + .toList(), ); Map _$ContributorParticipationToJson( @@ -61,9 +65,11 @@ Map _$ContributorParticipationToJson( YearCommitCountWeek _$YearCommitCountWeekFromJson(Map json) => YearCommitCountWeek( - days: (json['days'] as List?)?.map((e) => e as int).toList(), - total: json['total'] as int?, - timestamp: json['timestamp'] as int?, + days: (json['days'] as List?) + ?.map((e) => (e as num).toInt()) + .toList(), + total: (json['total'] as num?)?.toInt(), + timestamp: (json['timestamp'] as num?)?.toInt(), ); Map _$YearCommitCountWeekToJson( @@ -76,9 +82,9 @@ Map _$YearCommitCountWeekToJson( WeeklyChangesCount _$WeeklyChangesCountFromJson(Map json) => WeeklyChangesCount( - timestamp: json['timestamp'] as int?, - additions: json['additions'] as int?, - deletions: json['deletions'] as int?, + timestamp: (json['timestamp'] as num?)?.toInt(), + additions: (json['additions'] as num?)?.toInt(), + deletions: (json['deletions'] as num?)?.toInt(), ); Map _$WeeklyChangesCountToJson(WeeklyChangesCount instance) => @@ -90,9 +96,9 @@ Map _$WeeklyChangesCountToJson(WeeklyChangesCount instance) => PunchcardEntry _$PunchcardEntryFromJson(Map json) => PunchcardEntry( - weekday: json['weekday'] as int?, - hour: json['hour'] as int?, - commits: json['commits'] as int?, + weekday: (json['weekday'] as num?)?.toInt(), + hour: (json['hour'] as num?)?.toInt(), + commits: (json['commits'] as num?)?.toInt(), ); Map _$PunchcardEntryToJson(PunchcardEntry instance) => diff --git a/lib/src/common/model/repos_statuses.g.dart b/lib/src/common/model/repos_statuses.g.dart index 6cb7c947..86b7b8e3 100644 --- a/lib/src/common/model/repos_statuses.g.dart +++ b/lib/src/common/model/repos_statuses.g.dart @@ -11,7 +11,7 @@ CombinedRepositoryStatus _$CombinedRepositoryStatusFromJson( CombinedRepositoryStatus( state: json['state'] as String?, sha: json['sha'] as String?, - totalCount: json['total_count'] as int?, + totalCount: (json['total_count'] as num?)?.toInt(), statuses: (json['statuses'] as List?) ?.map((e) => RepositoryStatus.fromJson(e as Map)) .toList(), diff --git a/lib/src/common/model/search.g.dart b/lib/src/common/model/search.g.dart index d24fa9cb..9d606865 100644 --- a/lib/src/common/model/search.g.dart +++ b/lib/src/common/model/search.g.dart @@ -8,7 +8,7 @@ part of 'search.dart'; CodeSearchResults _$CodeSearchResultsFromJson(Map json) => CodeSearchResults() - ..totalCount = json['total_count'] as int? + ..totalCount = (json['total_count'] as num?)?.toInt() ..incompleteResults = json['incomplete_results'] as bool? ..items = CodeSearchItem.fromJsonList(json['items'] as List); diff --git a/lib/src/common/model/timeline.g.dart b/lib/src/common/model/timeline.g.dart index 9d0bfc5a..be7d916d 100644 --- a/lib/src/common/model/timeline.g.dart +++ b/lib/src/common/model/timeline.g.dart @@ -8,7 +8,7 @@ part of 'timeline.dart'; TimelineEvent _$TimelineEventFromJson(Map json) => TimelineEvent( - id: json['id'] as int? ?? 0, + id: (json['id'] as num?)?.toInt() ?? 0, nodeId: json['node_id'] as String?, url: json['url'] as String?, actor: json['actor'] == null @@ -40,7 +40,7 @@ Map _$TimelineEventToJson(TimelineEvent instance) => }; LabelEvent _$LabelEventFromJson(Map json) => LabelEvent( - id: json['id'] as int? ?? 0, + id: (json['id'] as num?)?.toInt() ?? 0, nodeId: json['node_id'] as String?, url: json['url'] as String?, actor: json['actor'] == null @@ -77,7 +77,7 @@ Map _$LabelEventToJson(LabelEvent instance) => MilestoneEvent _$MilestoneEventFromJson(Map json) => MilestoneEvent( - id: json['id'] as int? ?? 0, + id: (json['id'] as num?)?.toInt() ?? 0, nodeId: json['node_id'] as String?, url: json['url'] as String?, actor: json['actor'] == null @@ -113,7 +113,7 @@ Map _$MilestoneEventToJson(MilestoneEvent instance) => }; RenameEvent _$RenameEventFromJson(Map json) => RenameEvent( - id: json['id'] as int? ?? 0, + id: (json['id'] as num?)?.toInt() ?? 0, nodeId: json['node_id'] as String?, url: json['url'] as String?, actor: json['actor'] == null @@ -150,7 +150,7 @@ Map _$RenameEventToJson(RenameEvent instance) => ReviewRequestEvent _$ReviewRequestEventFromJson(Map json) => ReviewRequestEvent( - id: json['id'] as int? ?? 0, + id: (json['id'] as num?)?.toInt() ?? 0, nodeId: json['node_id'] as String?, url: json['url'] as String?, actor: json['actor'] == null @@ -195,7 +195,7 @@ Map _$ReviewRequestEventToJson(ReviewRequestEvent instance) => ReviewDismissedEvent _$ReviewDismissedEventFromJson( Map json) => ReviewDismissedEvent( - id: json['id'] as int? ?? 0, + id: (json['id'] as num?)?.toInt() ?? 0, nodeId: json['node_id'] as String?, url: json['url'] as String?, actor: json['actor'] == null @@ -233,7 +233,7 @@ Map _$ReviewDismissedEventToJson( }; LockEvent _$LockEventFromJson(Map json) => LockEvent( - id: json['id'] as int? ?? 0, + id: (json['id'] as num?)?.toInt() ?? 0, nodeId: json['node_id'] as String?, url: json['url'] as String?, actor: json['actor'] == null @@ -266,7 +266,7 @@ Map _$LockEventToJson(LockEvent instance) => { }; ProjectEvent _$ProjectEventFromJson(Map json) => ProjectEvent( - id: json['id'] as int? ?? 0, + id: (json['id'] as num?)?.toInt() ?? 0, nodeId: json['node_id'] as String?, url: json['url'] as String?, actor: json['actor'] == null @@ -302,7 +302,7 @@ Map _$ProjectEventToJson(ProjectEvent instance) => }; CommentEvent _$CommentEventFromJson(Map json) => CommentEvent( - id: json['id'] as int? ?? 0, + id: (json['id'] as num?)?.toInt() ?? 0, nodeId: json['node_id'] as String?, url: json['url'] as String?, actor: json['actor'] == null @@ -359,7 +359,7 @@ Map _$CommentEventToJson(CommentEvent instance) => CrossReferenceEvent _$CrossReferenceEventFromJson(Map json) => CrossReferenceEvent( - id: json['id'] as int? ?? 0, + id: (json['id'] as num?)?.toInt() ?? 0, nodeId: json['node_id'] as String?, url: json['url'] as String?, actor: json['actor'] == null @@ -401,7 +401,7 @@ Map _$CrossReferenceEventToJson( TimelineCommitEvent _$TimelineCommitEventFromJson(Map json) => TimelineCommitEvent( - id: json['id'] as int? ?? 0, + id: (json['id'] as num?)?.toInt() ?? 0, nodeId: json['node_id'] as String?, url: json['url'] as String?, actor: json['actor'] == null @@ -460,7 +460,7 @@ Map _$TimelineCommitEventToJson( }; ReviewEvent _$ReviewEventFromJson(Map json) => ReviewEvent( - id: json['id'] as int? ?? 0, + id: (json['id'] as num?)?.toInt() ?? 0, nodeId: json['node_id'] as String?, url: json['url'] as String?, actor: json['actor'] == null @@ -520,7 +520,7 @@ Map _$ReviewEventToJson(ReviewEvent instance) => TimelineLineCommentedEvent _$TimelineLineCommentedEventFromJson( Map json) => TimelineLineCommentedEvent( - id: json['id'] as int? ?? 0, + id: (json['id'] as num?)?.toInt() ?? 0, nodeId: json['node_id'] as String?, url: json['url'] as String?, actor: json['actor'] == null @@ -560,7 +560,7 @@ Map _$TimelineLineCommentedEventToJson( TimelineCommitCommentedEvent _$TimelineCommitCommentedEventFromJson( Map json) => TimelineCommitCommentedEvent( - id: json['id'] as int? ?? 0, + id: (json['id'] as num?)?.toInt() ?? 0, nodeId: json['node_id'] as String?, url: json['url'] as String?, actor: json['actor'] == null @@ -598,7 +598,7 @@ Map _$TimelineCommitCommentedEventToJson( AssigneeEvent _$AssigneeEventFromJson(Map json) => AssigneeEvent( - id: json['id'] as int? ?? 0, + id: (json['id'] as num?)?.toInt() ?? 0, nodeId: json['node_id'] as String?, url: json['url'] as String?, actor: json['actor'] == null @@ -636,7 +636,7 @@ Map _$AssigneeEventToJson(AssigneeEvent instance) => StateChangeIssueEvent _$StateChangeIssueEventFromJson( Map json) => StateChangeIssueEvent( - id: json['id'] as int? ?? 0, + id: (json['id'] as num?)?.toInt() ?? 0, nodeId: json['node_id'] as String?, url: json['url'] as String?, actor: json['actor'] == null diff --git a/lib/src/common/model/timeline_support.g.dart b/lib/src/common/model/timeline_support.g.dart index c1e441f2..83adf60a 100644 --- a/lib/src/common/model/timeline_support.g.dart +++ b/lib/src/common/model/timeline_support.g.dart @@ -17,8 +17,8 @@ GitHubApp _$GitHubAppFromJson(Map json) => GitHubApp( (json['events'] as List?)?.map((e) => e as String).toList(), externalUrl: json['external_url'] as String?, htmlUrl: json['html_url'] as String?, - id: json['id'] as int?, - installationsCount: json['installations_count'] as int?, + id: (json['id'] as num?)?.toInt(), + installationsCount: (json['installations_count'] as num?)?.toInt(), name: json['name'] as String?, nodeId: json['node_id'] as String?, owner: json['owner'] == null @@ -69,7 +69,7 @@ DismissedReview _$DismissedReviewFromJson(Map json) => DismissedReview( dismissalCommitId: json['dismissal_commit_id'] as String?, dismissalMessage: json['dismissal_message'] as String?, - reviewId: json['review_id'] as int?, + reviewId: (json['review_id'] as num?)?.toInt(), state: json['state'] as String?, ); @@ -83,9 +83,9 @@ Map _$DismissedReviewToJson(DismissedReview instance) => ProjectCard _$ProjectCardFromJson(Map json) => ProjectCard( columnName: json['column_name'] as String?, - id: json['id'] as int?, + id: (json['id'] as num?)?.toInt(), previousColumnName: json['previous_column_name'] as String?, - projectId: json['project_id'] as int?, + projectId: (json['project_id'] as num?)?.toInt(), projectUrl: json['project_url'] as String?, url: json['url'] as String?, ); @@ -160,7 +160,7 @@ TemplateRepository _$TemplateRepositoryFromJson(Map json) => downloadsUrl: json['downloads_url'] as String?, eventsUrl: json['events_url'] as String?, fork: json['fork'] as bool?, - forksCount: json['forks_count'] as int?, + forksCount: (json['forks_count'] as num?)?.toInt(), forksUrl: json['forks_url'] as String?, fullName: json['full_name'] as String?, gitCommitsUrl: json['git_commits_url'] as String?, @@ -175,7 +175,7 @@ TemplateRepository _$TemplateRepositoryFromJson(Map json) => homepage: json['homepage'] as String?, hooksUrl: json['hooks_url'] as String?, htmlUrl: json['html_url'] as String?, - id: json['id'] as int?, + id: (json['id'] as num?)?.toInt(), isTemplate: json['is_template'] as bool?, issueCommentUrl: json['issue_comment_url'] as String?, issueEventsUrl: json['issue_events_url'] as String?, @@ -190,10 +190,10 @@ TemplateRepository _$TemplateRepositoryFromJson(Map json) => milestonesUrl: json['milestones_url'] as String?, mirrorUrl: json['mirror_url'] as String?, name: json['name'] as String?, - networkCount: json['network_count'] as int?, + networkCount: (json['network_count'] as num?)?.toInt(), nodeId: json['node_id'] as String?, notificationsUrl: json['notifications_url'] as String?, - openIssuesCount: json['open_issues_count'] as int?, + openIssuesCount: (json['open_issues_count'] as num?)?.toInt(), owner: json['owner'] == null ? null : Owner.fromJson(json['owner'] as Map), @@ -206,14 +206,14 @@ TemplateRepository _$TemplateRepositoryFromJson(Map json) => ? null : DateTime.parse(json['pushed_at'] as String), releasesUrl: json['releases_url'] as String?, - size: json['size'] as int?, + size: (json['size'] as num?)?.toInt(), squashMergeCommitMessage: json['squash_merge_commit_message'] as String?, squashMergeCommitTitle: json['squash_merge_commit_title'] as String?, sshUrl: json['ssh_url'] as String?, - stargazersCount: json['stargazers_count'] as int?, + stargazersCount: (json['stargazers_count'] as num?)?.toInt(), stargazersUrl: json['stargazers_url'] as String?, statusesUrl: json['statuses_url'] as String?, - subscribersCount: json['subscribers_count'] as int?, + subscribersCount: (json['subscribers_count'] as num?)?.toInt(), subscribersUrl: json['subscribers_url'] as String?, subscriptionUrl: json['subscription_url'] as String?, svnUrl: json['svn_url'] as String?, @@ -228,7 +228,7 @@ TemplateRepository _$TemplateRepositoryFromJson(Map json) => : DateTime.parse(json['updated_at'] as String), url: json['url'] as String?, visibility: json['visibility'] as String?, - watchersCount: json['watchers_count'] as int?, + watchersCount: (json['watchers_count'] as num?)?.toInt(), ); Map _$TemplateRepositoryToJson(TemplateRepository instance) => @@ -329,7 +329,7 @@ Owner _$OwnerFromJson(Map json) => Owner( gistsUrl: json['gists_url'] as String?, gravatarId: json['gravatar_id'] as String?, htmlUrl: json['html_url'] as String?, - id: json['id'] as int?, + id: (json['id'] as num?)?.toInt(), login: json['login'] as String?, nodeId: json['node_id'] as String?, organizationsUrl: json['organizations_url'] as String?, diff --git a/lib/src/common/model/users.g.dart b/lib/src/common/model/users.g.dart index 40e4a306..1e61153c 100644 --- a/lib/src/common/model/users.g.dart +++ b/lib/src/common/model/users.g.dart @@ -7,7 +7,7 @@ part of 'users.dart'; // ************************************************************************** User _$UserFromJson(Map json) => User( - id: json['id'] as int?, + id: (json['id'] as num?)?.toInt(), login: json['login'] as String?, avatarUrl: json['avatar_url'] as String?, htmlUrl: json['html_url'] as String?, @@ -19,10 +19,10 @@ User _$UserFromJson(Map json) => User( email: json['email'] as String?, hirable: json['hirable'] as bool?, bio: json['bio'] as String?, - publicReposCount: json['public_repos'] as int?, - publicGistsCount: json['public_gists'] as int?, - followersCount: json['followers'] as int?, - followingCount: json['following'] as int?, + publicReposCount: (json['public_repos'] as num?)?.toInt(), + publicGistsCount: (json['public_gists'] as num?)?.toInt(), + followersCount: (json['followers'] as num?)?.toInt(), + followingCount: (json['following'] as num?)?.toInt(), createdAt: json['created_at'] == null ? null : DateTime.parse(json['created_at'] as String), @@ -85,7 +85,7 @@ Map _$UserToJson(User instance) => { Collaborator _$CollaboratorFromJson(Map json) => Collaborator( json['login'] as String?, - json['id'] as int?, + (json['id'] as num?)?.toInt(), json['html_url'] as String?, json['type'] as String?, json['site_admin'] as bool?, @@ -105,13 +105,13 @@ Map _$CollaboratorToJson(Collaborator instance) => }; Contributor _$ContributorFromJson(Map json) => Contributor( - id: json['id'] as int?, + id: (json['id'] as num?)?.toInt(), login: json['login'] as String?, avatarUrl: json['avatar_url'] as String?, htmlUrl: json['html_url'] as String?, type: json['type'] as String?, siteAdmin: json['site_admin'] as bool?, - contributions: json['contributions'] as int?, + contributions: (json['contributions'] as num?)?.toInt(), ); Map _$ContributorToJson(Contributor instance) => @@ -127,7 +127,7 @@ Map _$ContributorToJson(Contributor instance) => CurrentUser _$CurrentUserFromJson(Map json) => CurrentUser() ..login = json['login'] as String? - ..id = json['id'] as int? + ..id = (json['id'] as num?)?.toInt() ..avatarUrl = json['avatar_url'] as String? ..htmlUrl = json['html_url'] as String? ..siteAdmin = json['site_admin'] as bool? @@ -138,10 +138,10 @@ CurrentUser _$CurrentUserFromJson(Map json) => CurrentUser() ..email = json['email'] as String? ..hirable = json['hirable'] as bool? ..bio = json['bio'] as String? - ..publicReposCount = json['public_repos'] as int? - ..publicGistsCount = json['public_gists'] as int? - ..followersCount = json['followers'] as int? - ..followingCount = json['following'] as int? + ..publicReposCount = (json['public_repos'] as num?)?.toInt() + ..publicGistsCount = (json['public_gists'] as num?)?.toInt() + ..followersCount = (json['followers'] as num?)?.toInt() + ..followingCount = (json['following'] as num?)?.toInt() ..createdAt = json['created_at'] == null ? null : DateTime.parse(json['created_at'] as String) @@ -165,9 +165,9 @@ CurrentUser _$CurrentUserFromJson(Map json) => CurrentUser() ..subscriptionsUrl = json['subscriptions_url'] as String? ..type = json['type'] as String? ..url = json['url'] as String? - ..privateReposCount = json['total_private_repos'] as int? - ..ownedPrivateReposCount = json['owned_private_repos'] as int? - ..diskUsage = json['disk_usage'] as int? + ..privateReposCount = (json['total_private_repos'] as num?)?.toInt() + ..ownedPrivateReposCount = (json['owned_private_repos'] as num?)?.toInt() + ..diskUsage = (json['disk_usage'] as num?)?.toInt() ..plan = json['plan'] == null ? null : UserPlan.fromJson(json['plan'] as Map); @@ -215,9 +215,9 @@ Map _$CurrentUserToJson(CurrentUser instance) => UserPlan _$UserPlanFromJson(Map json) => UserPlan() ..name = json['name'] as String? - ..space = json['space'] as int? - ..privateReposCount = json['private_repos'] as int? - ..collaboratorsCount = json['collaborators'] as int?; + ..space = (json['space'] as num?)?.toInt() + ..privateReposCount = (json['private_repos'] as num?)?.toInt() + ..collaboratorsCount = (json['collaborators'] as num?)?.toInt(); Map _$UserPlanToJson(UserPlan instance) => { 'name': instance.name, diff --git a/lib/src/server/hooks.g.dart b/lib/src/server/hooks.g.dart index e78b6cc9..81cbb790 100644 --- a/lib/src/server/hooks.g.dart +++ b/lib/src/server/hooks.g.dart @@ -132,7 +132,7 @@ Map _$IssueEventToJson(IssueEvent instance) => PullRequestEvent _$PullRequestEventFromJson(Map json) => PullRequestEvent( action: json['action'] as String?, - number: json['number'] as int?, + number: (json['number'] as num?)?.toInt(), pullRequest: json['pull_request'] == null ? null : PullRequest.fromJson(json['pull_request'] as Map), From 137871baa8cf1f6b83d5e343af9c0f350d17fbfc Mon Sep 17 00:00:00 2001 From: Kevin Moore Date: Tue, 15 Apr 2025 09:59:25 -0500 Subject: [PATCH 19/23] Bump to latest lints (#417) Bump to latest lints, require Dart 3.5 --- .github/workflows/dart.yml | 2 +- CHANGELOG.md | 2 +- example/common.dart | 2 +- example/emoji.dart | 1 + example/index.dart | 2 ++ example/languages.dart | 2 +- example/organization.dart | 1 + example/pr.dart | 1 + example/readme.dart | 1 + example/release_notes.dart | 1 + example/releases.dart | 1 + example/repos.dart | 1 + example/search.dart | 2 ++ example/stars.dart | 1 + example/user_info.dart | 1 + example/users.dart | 1 + example/zen.dart | 2 ++ lib/browser_helper.dart | 3 ++- lib/hooks.dart | 3 +-- lib/src/browser/xplat_browser.dart | 2 ++ lib/src/common/activity_service.dart | 2 +- lib/src/common/github.dart | 8 ++++---- lib/src/common/util/pagination.dart | 1 - pubspec.yaml | 4 ++-- test/unit/orgs_service_test.dart | 1 - 25 files changed, 32 insertions(+), 16 deletions(-) diff --git a/.github/workflows/dart.yml b/.github/workflows/dart.yml index 1dcc0100..63b8adab 100644 --- a/.github/workflows/dart.yml +++ b/.github/workflows/dart.yml @@ -13,7 +13,7 @@ jobs: matrix: os: [ubuntu-latest] # Test with at least the declared minimum Dart version - sdk: ['3.1', stable] + sdk: ['3.5', stable] steps: - uses: actions/checkout@v4 - uses: dart-lang/setup-dart@v1 diff --git a/CHANGELOG.md b/CHANGELOG.md index 7939058a..7e6bd14e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ ## 9.25.0-wip -* Require Dart 3.1 +* Require Dart 3.5 * Require `package:http` `^1.0.0`. ## 9.24.0 diff --git a/example/common.dart b/example/common.dart index 1564a6c3..e508d0ee 100644 --- a/example/common.dart +++ b/example/common.dart @@ -1,4 +1,5 @@ import 'dart:async'; +// ignore: deprecated_member_use import 'dart:html'; import 'package:github/github.dart'; @@ -13,7 +14,6 @@ export 'package:github/github.dart'; Future initViewSourceButton(String script) async { // query the DOM for the view source button, handle clicks document.querySelector('#view-source')?.onClick.listen((_) { - // ignore: unsafe_html final popup = window.open( 'https://github.com/SpinlockLabs/github.dart/blob/master/example/$script', 'View Source'); diff --git a/example/emoji.dart b/example/emoji.dart index 7604d461..663269dd 100644 --- a/example/emoji.dart +++ b/example/emoji.dart @@ -1,4 +1,5 @@ import 'dart:async'; +// ignore: deprecated_member_use import 'dart:html'; import 'common.dart'; diff --git a/example/index.dart b/example/index.dart index 42851c96..535acd07 100644 --- a/example/index.dart +++ b/example/index.dart @@ -1,4 +1,6 @@ +// ignore: deprecated_member_use import 'dart:html'; + import 'common.dart'; void main() { diff --git a/example/languages.dart b/example/languages.dart index 02da85e0..aa8b7ec1 100644 --- a/example/languages.dart +++ b/example/languages.dart @@ -1,3 +1,4 @@ +// ignore: deprecated_member_use import 'dart:html'; import 'common.dart'; @@ -34,7 +35,6 @@ void reloadTable({int accuracy = 4}) { isReloadingTable = true; final md = generateMarkdown(accuracy); github.misc.renderMarkdown(md).then((html) { - // ignore: unsafe_html tableDiv!.setInnerHtml(html, treeSanitizer: NodeTreeSanitizer.trusted); isReloadingTable = false; }); diff --git a/example/organization.dart b/example/organization.dart index ef7135f8..d11d0fdd 100644 --- a/example/organization.dart +++ b/example/organization.dart @@ -1,4 +1,5 @@ import 'dart:async'; +// ignore: deprecated_member_use import 'dart:html'; import 'common.dart'; diff --git a/example/pr.dart b/example/pr.dart index 15e18180..660d4c45 100644 --- a/example/pr.dart +++ b/example/pr.dart @@ -1,4 +1,5 @@ import 'dart:async'; +// ignore: deprecated_member_use import 'dart:html'; import 'common.dart'; diff --git a/example/readme.dart b/example/readme.dart index ad9ec300..1920cca4 100644 --- a/example/readme.dart +++ b/example/readme.dart @@ -1,3 +1,4 @@ +// ignore: deprecated_member_use import 'dart:html'; import 'common.dart'; diff --git a/example/release_notes.dart b/example/release_notes.dart index be929744..27835cdd 100644 --- a/example/release_notes.dart +++ b/example/release_notes.dart @@ -1,3 +1,4 @@ +// ignore: deprecated_member_use import 'dart:html'; import 'package:pub_semver/pub_semver.dart'; diff --git a/example/releases.dart b/example/releases.dart index ddd19570..c244c962 100644 --- a/example/releases.dart +++ b/example/releases.dart @@ -1,3 +1,4 @@ +// ignore: deprecated_member_use import 'dart:html'; import 'common.dart'; diff --git a/example/repos.dart b/example/repos.dart index e7b21da4..409417ab 100644 --- a/example/repos.dart +++ b/example/repos.dart @@ -1,4 +1,5 @@ import 'dart:async'; +// ignore: deprecated_member_use import 'dart:html'; import 'common.dart'; diff --git a/example/search.dart b/example/search.dart index 9ca8b0ac..aeee9cbb 100644 --- a/example/search.dart +++ b/example/search.dart @@ -1,4 +1,6 @@ +// ignore: deprecated_member_use import 'dart:html'; + import 'common.dart'; Future main() async { diff --git a/example/stars.dart b/example/stars.dart index 52a95e54..2bc50b4c 100644 --- a/example/stars.dart +++ b/example/stars.dart @@ -1,3 +1,4 @@ +// ignore: deprecated_member_use import 'dart:html'; import 'common.dart'; diff --git a/example/user_info.dart b/example/user_info.dart index 071c2820..656207b1 100644 --- a/example/user_info.dart +++ b/example/user_info.dart @@ -1,3 +1,4 @@ +// ignore: deprecated_member_use import 'dart:html'; import 'common.dart'; diff --git a/example/users.dart b/example/users.dart index ab75a061..003d3f5d 100644 --- a/example/users.dart +++ b/example/users.dart @@ -1,4 +1,5 @@ import 'dart:async'; +// ignore: deprecated_member_use import 'dart:html'; import 'common.dart'; diff --git a/example/zen.dart b/example/zen.dart index 2e4d8b57..34c55c87 100644 --- a/example/zen.dart +++ b/example/zen.dart @@ -1,4 +1,6 @@ +// ignore: deprecated_member_use import 'dart:html'; + import 'common.dart'; Future main() async { diff --git a/lib/browser_helper.dart b/lib/browser_helper.dart index 0d9af0f1..39ebd393 100644 --- a/lib/browser_helper.dart +++ b/lib/browser_helper.dart @@ -1,4 +1,6 @@ +// ignore: deprecated_member_use import 'dart:html'; + import 'package:github/src/common.dart'; /// Renders Markdown in HTML using the GitHub API @@ -24,7 +26,6 @@ void renderMarkdown(GitHub github, String selector, {int indent = 4}) { e.hidden = false; e.setAttribute('rendered', ''); e.classes.add('markdown-body'); - // ignore: unsafe_html e.setInnerHtml(html, treeSanitizer: NodeTreeSanitizer.trusted); }); } diff --git a/lib/hooks.dart b/lib/hooks.dart index 1a336ed2..19fc3fae 100644 --- a/lib/hooks.dart +++ b/lib/hooks.dart @@ -7,7 +7,6 @@ /// Add this import if you are in a non-web environment and writing something /// that uses github hooks. For more information, see github hooks documentation /// https://developer.github.com/v3/repos/hooks/ - -library hooks; +library; export 'src/server/xplat_server.dart'; diff --git a/lib/src/browser/xplat_browser.dart b/lib/src/browser/xplat_browser.dart index 71bed55a..c54a2530 100644 --- a/lib/src/browser/xplat_browser.dart +++ b/lib/src/browser/xplat_browser.dart @@ -1,4 +1,6 @@ +// ignore: deprecated_member_use import 'dart:html'; + import 'package:github/src/common.dart'; import 'package:github/src/common/xplat_common.dart' show findAuthenticationInMap; diff --git a/lib/src/common/activity_service.dart b/lib/src/common/activity_service.dart index f69e8c49..f97aefcf 100644 --- a/lib/src/common/activity_service.dart +++ b/lib/src/common/activity_service.dart @@ -329,7 +329,7 @@ class EventPoller { final List handledEvents = []; Timer? _timer; - StreamController? _controller; // ignore: close_sinks + StreamController? _controller; String? _lastFetched; diff --git a/lib/src/common/github.dart b/lib/src/common/github.dart index ef803ea0..e6ba64cb 100644 --- a/lib/src/common/github.dart +++ b/lib/src/common/github.dart @@ -190,7 +190,7 @@ class GitHub { /// /// The future will pass the object returned from this function to the then method. /// The default [convert] function returns the input object. - /// [body] is the data to send to the server. Pass in a List if you want to post binary body data. Everything else will have .toString() called on it and set as text content + /// [body] is the data to send to the server. Pass in a `List` if you want to post binary body data. Everything else will have .toString() called on it and set as text content /// [S] represents the input type. /// [T] represents the type return from this function after conversion Future postJSON( @@ -232,7 +232,7 @@ class GitHub { /// /// The future will pass the object returned from this function to the then method. /// The default [convert] function returns the input object. - /// [body] is the data to send to the server. Pass in a List if you want to post binary body data. Everything else will have .toString() called on it and set as text content + /// [body] is the data to send to the server. Pass in a `List` if you want to post binary body data. Everything else will have .toString() called on it and set as text content /// [S] represents the input type. /// [T] represents the type return from this function after conversion Future putJSON( @@ -274,7 +274,7 @@ class GitHub { /// /// The future will pass the object returned from this function to the then method. /// The default [convert] function returns the input object. - /// [body] is the data to send to the server. Pass in a List if you want to post binary body data. Everything else will have .toString() called on it and set as text content + /// [body] is the data to send to the server. Pass in a `List` if you want to post binary body data. Everything else will have .toString() called on it and set as text content /// [S] represents the input type. /// [T] represents the type return from this function after conversion Future patchJSON( @@ -343,7 +343,7 @@ class GitHub { /// [path] can either be a path like '/repos' or a full url. /// [headers] are HTTP Headers. If it doesn't exist, the 'Accept' and 'Authorization' headers are added. /// [params] are query string parameters. - /// [body] is the body content of requests that take content. Pass in a List if you want to post binary body data. Everything else will have .toString() called on it and set as text content + /// [body] is the body content of requests that take content. Pass in a `List` if you want to post binary body data. Everything else will have .toString() called on it and set as text content /// Future request( String method, diff --git a/lib/src/common/util/pagination.dart b/lib/src/common/util/pagination.dart index 95d47107..40cf621a 100644 --- a/lib/src/common/util/pagination.dart +++ b/lib/src/common/util/pagination.dart @@ -31,7 +31,6 @@ class PaginationHelper { var page = params['page'] ?? 1; params['page'] = page; - // ignore: literal_only_boolean_expressions while (true) { http.Response response; try { diff --git a/pubspec.yaml b/pubspec.yaml index 9b29ea72..b2f9b7f0 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -4,7 +4,7 @@ description: A high-level GitHub API Client Library that uses Github's v3 API homepage: https://github.com/SpinlockLabs/github.dart environment: - sdk: ^3.1.0 + sdk: ^3.5.0 dependencies: http: ^1.0.0 @@ -19,7 +19,7 @@ dev_dependencies: collection: ^1.15.0 dependency_validator: ^3.0.0 json_serializable: ^6.6.1 - lints: ^4.0.0 + lints: ^5.0.0 mockito: ^5.3.2 nock: ^1.1.3 pub_semver: ^2.0.0 diff --git a/test/unit/orgs_service_test.dart b/test/unit/orgs_service_test.dart index 04fff9e1..9ba4ff3f 100644 --- a/test/unit/orgs_service_test.dart +++ b/test/unit/orgs_service_test.dart @@ -93,7 +93,6 @@ void main() { final github = GitHub(client: client); final organizationsService = OrganizationsService(github); - // ignore: omit_local_variable_types expect( () async => organizationsService.getTeamByName( 'flutter', 'flutter-programmers'), From d13786fb89e02266ae6c099bf3f0d79b4dc6eafe Mon Sep 17 00:00:00 2001 From: Kevin Moore Date: Thu, 17 Apr 2025 20:10:34 -0500 Subject: [PATCH 20/23] Fix pagination logic to use `next` link (#418) * Fix pagination logic to use `next` link Fixes https://github.com/SpinlockLabs/github.dart/issues/414 * Fix tests --- CHANGELOG.md | 3 ++- lib/src/common/util/pagination.dart | 6 ++---- pubspec.yaml | 2 +- test/common/repos_service_test.dart | 4 ++-- test/git_test.dart | 2 +- 5 files changed, 8 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e6bd14e..8c92ab04 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,8 @@ -## 9.25.0-wip +## 9.25.0 * Require Dart 3.5 * Require `package:http` `^1.0.0`. +* Fix pagination logic to use `next` link. ## 9.24.0 diff --git a/lib/src/common/util/pagination.dart b/lib/src/common/util/pagination.dart index 40cf621a..93f3a0d7 100644 --- a/lib/src/common/util/pagination.dart +++ b/lib/src/common/util/pagination.dart @@ -28,9 +28,6 @@ class PaginationHelper { params = Map.from(params); } - var page = params['page'] ?? 1; - params['page'] = page; - while (true) { http.Response response; try { @@ -70,7 +67,8 @@ class PaginationHelper { break; } - params['page'] = ++page; + path = next; + params = null; } } diff --git a/pubspec.yaml b/pubspec.yaml index b2f9b7f0..8168d555 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: github -version: 9.25.0-wip +version: 9.25.0 description: A high-level GitHub API Client Library that uses Github's v3 API homepage: https://github.com/SpinlockLabs/github.dart diff --git a/test/common/repos_service_test.dart b/test/common/repos_service_test.dart index feebe05c..2f3f9120 100644 --- a/test/common/repos_service_test.dart +++ b/test/common/repos_service_test.dart @@ -16,7 +16,7 @@ void main() { test('listCommits', () async { final repositories = create((request) async { expect(request.url.path, '/repos/${slug.fullName}/commits'); - expect(request.url.query, 'page=1'); + expect(request.url.query, isEmpty); return Response(listCommits, StatusCodes.OK); }); @@ -29,7 +29,7 @@ void main() { expect(request.url.path, '/repos/${slug.fullName}/commits'); expect( request.url.query, - 'author=octocat&committer=octodog&sha=abc&path=%2Fpath&since=2022-02-22T00%3A00%3A00.000&until=2023-02-22T00%3A00%3A00.000&page=1', + 'author=octocat&committer=octodog&sha=abc&path=%2Fpath&since=2022-02-22T00%3A00%3A00.000&until=2023-02-22T00%3A00%3A00.000', ); return Response(listCommits, StatusCodes.OK); }); diff --git a/test/git_test.dart b/test/git_test.dart index 228b3a0b..e95ef5d6 100644 --- a/test/git_test.dart +++ b/test/git_test.dart @@ -172,7 +172,7 @@ void main() { test('code search', () async { nock(fakeApiUrl) .get( - '/search/code?q=search%20repo%3ASpinlockLabs%2Fgithub.dart%20in%3Afile&per_page=20&page=1') + '/search/code?q=search%20repo%3ASpinlockLabs%2Fgithub.dart%20in%3Afile&per_page=20') .reply(200, nocked.searchResults); final results = (await github.search From 4256ac1e8baeeca975b1d75abe60b0fbda73e001 Mon Sep 17 00:00:00 2001 From: "John \"codefu\" McDole" Date: Thu, 17 Apr 2025 18:11:11 -0700 Subject: [PATCH 21/23] Handle 'null' conclusion (#413) Creating a new concolusion with the GitHub API and then encoding that CheckRun to json adds: `"conclusion":"null"` to the json string; attempting to decode that throws an exception. Fixes #412 Co-authored-by: Rob Becker --- lib/src/common/model/checks.dart | 2 +- test/unit/checks_test.dart | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/src/common/model/checks.dart b/lib/src/common/model/checks.dart index 5068febc..b7666579 100644 --- a/lib/src/common/model/checks.dart +++ b/lib/src/common/model/checks.dart @@ -54,7 +54,7 @@ class CheckRunConclusion extends EnumWithValue { const CheckRunConclusion._(super.value); factory CheckRunConclusion._fromValue(String? value) { - if (value == null) { + if (value == null || value == 'null') { return empty; } for (final level in const [ diff --git a/test/unit/checks_test.dart b/test/unit/checks_test.dart index 8af59043..2eb7e6c4 100644 --- a/test/unit/checks_test.dart +++ b/test/unit/checks_test.dart @@ -100,6 +100,9 @@ const checkRunJson = '''{ const String expectedToString = '{"name":"mighty_readme","id":4,"external_id":"","status":"completed","head_sha":"","check_suite":{"id":5},"details_url":"https://example.com","started_at":"2018-05-04T01:14:52.000Z","conclusion":"neutral"}'; +const String newCheckRun = + '{"name":"New CheckRun","id":12345,"external_id":"","status":"queued","head_sha":"","check_suite":{"id":123456},"details_url":"https://example.com","started_at":"2024-12-05T01:05:24.000Z","conclusion":"null"}'; + void main() { group('Check run', () { test('CheckRun fromJson', () { @@ -110,6 +113,14 @@ void main() { expect(checkRun.conclusion, CheckRunConclusion.neutral); }); + test('CheckRun from freshly created and encoded', () { + final checkRun = CheckRun.fromJson(jsonDecode(newCheckRun)); + + expect(checkRun.id, 12345); + expect(checkRun.name, 'New CheckRun'); + expect(checkRun.conclusion, CheckRunConclusion.empty); + }); + test('CheckRun fromJson for skipped conclusion', () { /// The checkRun Json is the official Github values /// From 98f2e48df1736ec63ef48e086fefd4efbb522751 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 17 Apr 2025 19:16:11 -0600 Subject: [PATCH 22/23] Bump JamesIves/github-pages-deploy-action from 4.5.0 to 4.6.1 (#408) Bumps [JamesIves/github-pages-deploy-action](https://github.com/jamesives/github-pages-deploy-action) from 4.5.0 to 4.6.1. - [Release notes](https://github.com/jamesives/github-pages-deploy-action/releases) - [Commits](https://github.com/jamesives/github-pages-deploy-action/compare/v4.5.0...v4.6.1) --- updated-dependencies: - dependency-name: JamesIves/github-pages-deploy-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Rob Becker --- .github/workflows/publish_demos.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish_demos.yml b/.github/workflows/publish_demos.yml index 603b4a09..b6b6169e 100644 --- a/.github/workflows/publish_demos.yml +++ b/.github/workflows/publish_demos.yml @@ -24,7 +24,7 @@ jobs: rm build/example/packages - name: Publish 🚀 - uses: JamesIves/github-pages-deploy-action@v4.5.0 + uses: JamesIves/github-pages-deploy-action@v4.6.1 with: branch: gh-pages # The branch the action should deploy to. folder: build/example # The folder the action should deploy. From c3a02992b14d370ac8bd3ef2a09a588db2e2dbcb Mon Sep 17 00:00:00 2001 From: Kevin Moore Date: Thu, 17 Apr 2025 22:11:02 -0500 Subject: [PATCH 23/23] Drop mockito and rebuild (#419) --- lib/src/common/model/git.g.dart | 20 ++++++-------------- pubspec.yaml | 1 - 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/lib/src/common/model/git.g.dart b/lib/src/common/model/git.g.dart index e041aeb3..ccbb082b 100644 --- a/lib/src/common/model/git.g.dart +++ b/lib/src/common/model/git.g.dart @@ -95,20 +95,12 @@ GitCommitUser _$GitCommitUserFromJson(Map json) => json['date'] == null ? null : DateTime.parse(json['date'] as String), ); -Map _$GitCommitUserToJson(GitCommitUser instance) { - final val = {}; - - void writeNotNull(String key, dynamic value) { - if (value != null) { - val[key] = value; - } - } - - writeNotNull('name', instance.name); - writeNotNull('email', instance.email); - writeNotNull('date', dateToGitHubIso8601(instance.date)); - return val; -} +Map _$GitCommitUserToJson(GitCommitUser instance) => + { + if (instance.name case final value?) 'name': value, + if (instance.email case final value?) 'email': value, + if (dateToGitHubIso8601(instance.date) case final value?) 'date': value, + }; GitTree _$GitTreeFromJson(Map json) => GitTree( json['sha'] as String?, diff --git a/pubspec.yaml b/pubspec.yaml index 8168d555..eed1fec4 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -20,7 +20,6 @@ dev_dependencies: dependency_validator: ^3.0.0 json_serializable: ^6.6.1 lints: ^5.0.0 - mockito: ^5.3.2 nock: ^1.1.3 pub_semver: ^2.0.0 test: ^1.21.6