diff --git a/.github/workflows/publish_release.yml b/.github/workflows/publish_release.yml index c9c1df8f..3743cd63 100644 --- a/.github/workflows/publish_release.yml +++ b/.github/workflows/publish_release.yml @@ -12,9 +12,9 @@ jobs: steps: - name: Checkout uses: actions/checkout@v1 - - name: Setup credentials - run: | - mkdir -p ~/.pub-cache - echo ${{ secrets.CREDENTIAL_JSON }} > ~/.pub-cache/credentials.json - - name: Publish package - run: pub publish -f \ No newline at end of file + - name: Setup credentials + run: | + mkdir -p ~/.pub-cache + echo ${{ secrets.CREDENTIAL_JSON }} > ~/.pub-cache/credentials.json + - name: Publish package + run: pub publish -f \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index d09d1b76..5de4e987 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ +## 9.5.0 + +* Add 'commits' member to GitHubComparison object by @fuzzybinary in https://github.com/SpinlockLabs/github.dart/pull/330 + +## New Contributors +* @fuzzybinary made their first contribution in https://github.com/SpinlockLabs/github.dart/pull/330 + +**Full Changelog**: https://github.com/SpinlockLabs/github.dart/compare/9.4.1...9.5.0 + ## 9.4.1 * Update to github-script 6 by @robbecker-wf in https://github.com/SpinlockLabs/github.dart/pull/331 diff --git a/lib/src/common/model/repos.dart b/lib/src/common/model/repos.dart index 739d6ca2..3612aa34 100644 --- a/lib/src/common/model/repos.dart +++ b/lib/src/common/model/repos.dart @@ -11,9 +11,10 @@ class GitHubComparison { final int? behindBy; final int? totalCommits; final List? files; + final List? commits; GitHubComparison(this.url, this.status, this.aheadBy, this.behindBy, - this.totalCommits, this.files); + this.totalCommits, this.files, this.commits); factory GitHubComparison.fromJson(Map json) => _$GitHubComparisonFromJson(json); diff --git a/lib/src/common/model/repos.g.dart b/lib/src/common/model/repos.g.dart index 78184d6f..b2e395bd 100644 --- a/lib/src/common/model/repos.g.dart +++ b/lib/src/common/model/repos.g.dart @@ -16,6 +16,9 @@ GitHubComparison _$GitHubComparisonFromJson(Map json) => (json['files'] as List?) ?.map((e) => CommitFile.fromJson(e as Map)) .toList(), + (json['commits'] as List?) + ?.map((e) => RepositoryCommit.fromJson(e as Map)) + .toList(), ); Map _$GitHubComparisonToJson(GitHubComparison instance) => @@ -26,6 +29,7 @@ Map _$GitHubComparisonToJson(GitHubComparison instance) => 'behind_by': instance.behindBy, 'total_commits': instance.totalCommits, 'files': instance.files, + 'commits': instance.commits, }; Repository _$RepositoryFromJson(Map json) => Repository( diff --git a/pubspec.yaml b/pubspec.yaml index 9aa43f84..77f1f627 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: github -version: 9.4.1 +version: 9.5.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/src/mocks.mocks.dart b/test/src/mocks.mocks.dart index 6b9c20c5..c381f58a 100644 --- a/test/src/mocks.mocks.dart +++ b/test/src/mocks.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.0.17 from annotations +// Mocks generated by Mockito 5.2.0 from annotations // in github/test/src/mocks.dart. // Do not manually edit this file. @@ -8,14 +8,13 @@ import 'package:github/src/common.dart' as _i3; import 'package:http/http.dart' as _i2; import 'package:mockito/mockito.dart' as _i1; +// ignore_for_file: type=lint // ignore_for_file: avoid_redundant_argument_values // ignore_for_file: avoid_setters_without_getters -// ignore_for_file: camel_case_types // ignore_for_file: comment_references // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member // ignore_for_file: prefer_const_constructors -// ignore_for_file: unnecessary_overrides // ignore_for_file: unnecessary_parenthesis // ignore_for_file: camel_case_types diff --git a/test/unit/checks_test.dart b/test/unit/checks_test.dart index 7d77662c..8af59043 100644 --- a/test/unit/checks_test.dart +++ b/test/unit/checks_test.dart @@ -97,12 +97,12 @@ 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 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"}'; void main() { group('Check run', () { test('CheckRun fromJson', () { - final checkRun = CheckRun.fromJson(jsonDecode(checkRunJson)); expect(checkRun.id, 4); diff --git a/tool/release_unreleased_prs.dart b/tool/release_unreleased_prs.dart index 372eefc4..aca8dae1 100644 --- a/tool/release_unreleased_prs.dart +++ b/tool/release_unreleased_prs.dart @@ -49,7 +49,8 @@ Future main(List args) async { 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'); + await _gh.issues.createComment(_slug, i.number, + 'Released in version $nextVersion https://github.com/$fullrepo/releases/tag/$nextVersion'); } exit(0); @@ -92,15 +93,21 @@ Future getLatestVersion(RepositorySlug slug) async { 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(); + 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 = Set(); - for (final pr in unreleased){ - var prlabels = pr.labels.where((element) => element.name.startsWith('semver:')).toList(); + 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); } @@ -118,13 +125,14 @@ String getNextVersion(Version currentVersion, List unreleased) { return newVersion; } -Future generateReleaseNotes(String fromVersion, String newVersion) async { +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; @@ -147,8 +155,8 @@ void updatePubspec(String newVersion) { } Future createRelease(String version, String target) async { - print('Creating release ...'); - var release = await _gh.repositories.createRelease( + print('Creating release ...'); + var release = await _gh.repositories.createRelease( _slug, CreateRelease.from( tagName: version, @@ -158,13 +166,13 @@ Future createRelease(String version, String target) async { isDraft: false, isPrerelease: false)); - print('Release ${release.name} created ${release.createdAt}'); - print(release.body); - return release; + 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'); -} \ No newline at end of file +}