Skip to content

Commit 2c1cee6

Browse files
committed
Use github token if it exists.
1 parent bd88904 commit 2c1cee6

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

.github/workflows/build.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ jobs:
3333
- name: Fetch latest dart_shared_library
3434
run: |
3535
dart ./tools/fetch_dart/bin/fetch_dart.dart --verbose
36+
env:
37+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3638
- name: Build Shared Library
3739
run: |
3840
cmake -DCMAKE_BUILD_TYPE=Release . -B "build"
@@ -50,9 +52,15 @@ jobs:
5052
continue-on-error: false
5153
steps:
5254
- uses: actions/checkout@v3
55+
- uses: dart-lang/setup-dart@v1
5356
- uses: actions/download-artifact@v3
5457
with:
5558
path: artifacts
59+
- name: Fetch latest dart_shared_library
60+
run: |
61+
dart ./tools/fetch_dart/bin/fetch_dart.dart --verbose
62+
env:
63+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5664
- name: "Create extension"
5765
run: |
5866
mkdir -p out/extension

tools/fetch_dart/bin/fetch_dart.dart

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import 'package:path/path.dart' as path;
99

1010
final destDir = Directory('src/dart_dll');
1111
final destBinDir = Directory(path.join(destDir.path, 'bin/release'));
12-
final destIncludeDir = Directory(path.join(destDir.path, 'bin/release'));
12+
final destIncludeDir = Directory(path.join(destDir.path, 'include'));
1313

1414
ArgParser buildParser() {
1515
return ArgParser()
@@ -138,7 +138,11 @@ void _fetchLocal(String localPath, Logger l) async {
138138
}
139139

140140
void _fetchFromGithub(String? version, Logger l) async {
141-
final github = GitHub();
141+
final authToken = Platform.environment['GITHUB_TOKEN'];
142+
final auth = authToken == null
143+
? Authentication.anonymous()
144+
: Authentication.withToken(authToken);
145+
final github = GitHub(auth: auth);
142146
final repoSlug = RepositorySlug('fuzzybinary', 'dart_shared_library');
143147

144148
final Release downloadRelease;

0 commit comments

Comments
 (0)