Skip to content

Commit b735fa5

Browse files
committed
fix (nit): formatted dart codes
1 parent 4f04988 commit b735fa5

File tree

11 files changed

+123
-118
lines changed

11 files changed

+123
-118
lines changed

actions/lib/src/android/shell_script.dart

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,21 @@ extension type ShellScript(String script) {
1515
set -eo pipefail
1616
$script
1717
''';
18-
core.info('Running script:\n$fullScript\n=======================================');
18+
core.info(
19+
'Running script:\n$fullScript\n=======================================');
1920
await fs.withTempDir('launch_android_emulator', (tempDir) async {
2021
final scriptPath = p.join(tempDir, 'script.sh');
2122
fs.writeFileSync(scriptPath, fullScript);
2223
final result = await processManager.start(
23-
['/bin/bash', scriptPath],
24+
['/bin/bash', scriptPath],
2425
mode: ProcessStartMode.inheritStdio,
2526
);
2627
final exitCode = await result.exitCode;
2728
if (exitCode != 0) {
2829
throw ProcessException(
2930
'/bin/bash',
3031
[script],
31-
'Script failed with exit code',
32+
'Script failed with exit code',
3233
exitCode,
3334
);
3435
}

actions/lib/src/node/actions/cache.dart

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,23 @@ import 'dart:js_interop';
77
external Cache get cache;
88

99
/// Tools for interacting with the GitHub Actions cache.
10-
///
10+
///
1111
/// See: https://www.npmjs.com/package/@actions/cache
1212
@JS()
1313
@anonymous
1414
extension type Cache._(JSObject it) {
1515
/// Returns true if Actions cache service feature is available, otherwise false.
1616
external bool isFeatureAvailable();
17-
17+
1818
@JS('restoreCache')
1919
external JSPromise _restoreCache(
2020
JSArray paths,
21-
String primaryKey,[
21+
String primaryKey, [
2222
JSArray? restoreKeys,
2323
]);
2424

2525
/// Restores cache from keys
26-
///
26+
///
2727
/// @param paths a list of file paths to restore from the cache
2828
/// @param primaryKey an explicit key for restoring the cache
2929
/// @param restoreKeys an optional ordered list of keys to use for restoring the cache if no cache hit occurred for key
@@ -34,7 +34,7 @@ extension type Cache._(JSObject it) {
3434
List<String>? restoreKeys,
3535
}) async {
3636
final promise = _restoreCache(
37-
paths.map((p) => p.toJS).toList().toJS,
37+
paths.map((p) => p.toJS).toList().toJS,
3838
primaryKey,
3939
restoreKeys?.map((key) => key.toJS).toList().toJS,
4040
);
@@ -49,7 +49,7 @@ extension type Cache._(JSObject it) {
4949
);
5050

5151
/// Saves a list of files with the specified key
52-
///
52+
///
5353
/// @param paths a list of file paths to be cached
5454
/// @param primaryKey an explicit key for restoring the cache
5555
/// @returns number returns cacheId if the cache was saved successfully and throws an error if save fails
@@ -58,7 +58,7 @@ extension type Cache._(JSObject it) {
5858
required String primaryKey,
5959
}) async {
6060
final promise = _saveCache(
61-
paths.map((path) => path.toJS).toList().toJS,
61+
paths.map((path) => path.toJS).toList().toJS,
6262
primaryKey,
6363
);
6464
final result = await promise.toDart;

actions/lib/src/node/actions/core.dart

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ extension type Core._(JSObject it) {
2222

2323
String getRequiredInput(String name) {
2424
final inputValue = _getInput(name);
25-
return inputValue.isEmpty ? (throw StateError('Input "$name" was required but no value was passed')) : inputValue;
25+
return inputValue.isEmpty
26+
? (throw StateError(
27+
'Input "$name" was required but no value was passed'))
28+
: inputValue;
2629
}
2730

2831
T getTypedInput<T>(
@@ -50,7 +53,7 @@ extension type Core._(JSObject it) {
5053
external void endGroup();
5154

5255
Future<R> withGroup<R>(
53-
String name,
56+
String name,
5457
Future<R> Function() action,
5558
) async {
5659
startGroup(name);

actions/lib/src/node/actions/exec.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ extension type Exec._(JSObject it) {
4545
try {
4646
final exitCode = await promiseToFuture<int>(
4747
_exec(
48-
commandLine,
48+
commandLine,
4949
args.map((arg) => arg.toJS).toList().toJS,
5050
options,
5151
),

actions/lib/src/node/actions/github.dart

Lines changed: 84 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ external GitHub get github;
1212
@anonymous
1313
extension type GitHub._(JSObject it) {
1414
/// The GitHub context this action is running in.
15-
///
15+
///
1616
/// See: https://docs.github.com/en/actions/learn-github-actions/contexts#github-context
1717
external GitHubContext get context;
1818
}
1919

2020
/// A typed representation of the `github` context object.
21-
///
22-
/// See also:
21+
///
22+
/// See also:
2323
/// - https://docs.github.com/en/actions/learn-github-actions/contexts#github-context
2424
/// - https://docs.github.com/en/actions/learn-github-actions/variables#default-environment-variables
2525
@JS('github.Context')
@@ -28,102 +28,102 @@ extension type GitHubContext._(JSObject it) {
2828
external WebhookPayload get payload;
2929

3030
/// The name of the event that triggered the workflow run.
31-
///
31+
///
3232
/// From the `GITHUB_EVENT_NAME` environment variable.
3333
external String get eventName;
3434

35-
/// The commit SHA that triggered the workflow.
36-
///
37-
/// The value of this commit SHA depends on the event that triggered the workflow.
35+
/// The commit SHA that triggered the workflow.
36+
///
37+
/// The value of this commit SHA depends on the event that triggered the workflow.
3838
/// For more information, see [Events that trigger workflows](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows).
39-
///
39+
///
4040
/// For example, `ffac537e6cbbf934b08745a378932722df287a53`.
41-
///
41+
///
4242
/// From the `GITHUB_SHA` environment variable.
4343
external String get sha;
4444

45-
/// The fully-formed ref of the branch or tag that triggered the workflow run.
46-
///
47-
/// For workflows triggered by push, this is the branch or tag ref that was pushed.
48-
/// For workflows triggered by pull_request, this is the pull request merge branch.
49-
/// For workflows triggered by release, this is the release tag created. For other
50-
/// triggers, this is the branch or tag ref that triggered the workflow run.
51-
///
52-
/// This is only set if a branch or tag is available for the event type. The ref given
53-
/// is fully-formed, meaning that for branches the format is `refs/heads/<branch_name>`,
54-
/// for pull requests it is `refs/pull/<pr_number>/merge`, and for tags it is
55-
/// `refs/tags/<tag_name>`.
56-
///
45+
/// The fully-formed ref of the branch or tag that triggered the workflow run.
46+
///
47+
/// For workflows triggered by push, this is the branch or tag ref that was pushed.
48+
/// For workflows triggered by pull_request, this is the pull request merge branch.
49+
/// For workflows triggered by release, this is the release tag created. For other
50+
/// triggers, this is the branch or tag ref that triggered the workflow run.
51+
///
52+
/// This is only set if a branch or tag is available for the event type. The ref given
53+
/// is fully-formed, meaning that for branches the format is `refs/heads/<branch_name>`,
54+
/// for pull requests it is `refs/pull/<pr_number>/merge`, and for tags it is
55+
/// `refs/tags/<tag_name>`.
56+
///
5757
/// For example, `refs/heads/feature-branch-1`.
58-
///
58+
///
5959
/// From the `GITHUB_REF` environment variable.
6060
external String get ref;
6161

62-
/// The name of the workflow. If the workflow file doesn't specify a `name`, the value of
62+
/// The name of the workflow. If the workflow file doesn't specify a `name`, the value of
6363
/// this property is the full path of the workflow file in the repository.
64-
///
64+
///
6565
/// From the `GITHUB_WORKFLOW` environment variable.
6666
external String get workflow;
6767

68-
/// The name of the action currently running, or the `id` of a step.
69-
///
70-
/// GitHub removes special characters, and uses the name `__run` when the current step runs
71-
/// a script without an `id`. If you use the same action more than once in the same job,
72-
/// the name will include a suffix with the sequence number with underscore before it.
73-
///
74-
/// For example, the first script you run will have the name `__run`, and the second script
75-
/// will be named `__run_2`. Similarly, the second invocation of `actions/checkout` will be
68+
/// The name of the action currently running, or the `id` of a step.
69+
///
70+
/// GitHub removes special characters, and uses the name `__run` when the current step runs
71+
/// a script without an `id`. If you use the same action more than once in the same job,
72+
/// the name will include a suffix with the sequence number with underscore before it.
73+
///
74+
/// For example, the first script you run will have the name `__run`, and the second script
75+
/// will be named `__run_2`. Similarly, the second invocation of `actions/checkout` will be
7676
/// `actionscheckout2`.
77-
///
77+
///
7878
/// From the `GITHUB_ACTION` environment variable.
7979
external String get action;
8080

81-
/// The username of the user that triggered the initial workflow run.
82-
///
83-
/// If the workflow run is a re-run, this value may differ from `github.triggering_actor`.
84-
/// Any workflow re-runs will use the privileges of `github.actor`, even if the actor initiating
81+
/// The username of the user that triggered the initial workflow run.
82+
///
83+
/// If the workflow run is a re-run, this value may differ from `github.triggering_actor`.
84+
/// Any workflow re-runs will use the privileges of `github.actor`, even if the actor initiating
8585
/// the re-run (`github.triggering_actor`) has different privileges.
86-
///
86+
///
8787
/// From the `GITHUB_ACTOR` environment variable.
8888
external String get actor;
8989

9090
/// The `job_id` of the current job.
91-
///
92-
/// **Note:** This context property is set by the Actions runner, and is only available within
91+
///
92+
/// **Note:** This context property is set by the Actions runner, and is only available within
9393
/// the execution `steps` of a job. Otherwise, the value of this property will be `null`.
94-
///
94+
///
9595
/// From the `GITHUB_JOB` environment variable.
9696
external String get job;
9797

98-
/// A unique number for each run of a particular workflow in a repository.
99-
///
100-
/// This number begins at 1 for the workflow's first run, and increments with each new run. This
98+
/// A unique number for each run of a particular workflow in a repository.
99+
///
100+
/// This number begins at 1 for the workflow's first run, and increments with each new run. This
101101
/// number does not change if you re-run the workflow run.
102-
///
102+
///
103103
/// From the `GITHUB_RUN_NUMBER` environment variable.
104104
external int get runNumber;
105105

106-
/// A unique number for each workflow run within a repository.
107-
///
106+
/// A unique number for each workflow run within a repository.
107+
///
108108
/// This number does not change if you re-run the workflow run.
109-
///
109+
///
110110
/// From the `GITHUB_RUN_ID` environment variable.
111111
external int get runId;
112112

113113
/// The URL of the GitHub REST API.
114-
///
114+
///
115115
/// From the `GITHUB_API_URL` environment variable.
116116
external String get apiUrl;
117117

118-
/// The URL of the GitHub server.
119-
///
118+
/// The URL of the GitHub server.
119+
///
120120
/// For example: `https://github.com`.
121-
///
121+
///
122122
/// From the `GITHUB_SERVER_URL` environment variable.
123123
external String get serverUrl;
124124

125125
/// The URL of the GitHub GraphQL API.
126-
///
126+
///
127127
/// From the `GITHUB_GRAPHQL_URL` environment variable.
128128
external String get graphqlUrl;
129129

@@ -133,56 +133,57 @@ extension type GitHubContext._(JSObject it) {
133133
/// The repo from which this action was run.
134134
external GitHubRepo get repo;
135135

136-
/// The name of the base ref or target branch of the pull request in a workflow run.
137-
///
136+
/// The name of the base ref or target branch of the pull request in a workflow run.
137+
///
138138
/// This is only set when the event that triggers a workflow run is either `pull_request`
139-
/// or `pull_request_target`.
140-
///
139+
/// or `pull_request_target`.
140+
///
141141
/// For example, `main`.
142-
///
142+
///
143143
/// From the `GITHUB_BASE_REF` environment variable.
144144
String? get baseRef => process.getEnv('GITHUB_BASE_REF');
145145

146-
/// The head ref or source branch of the pull request in a workflow run.
147-
///
148-
/// This property is only set when the event that triggers a workflow run is either
149-
/// `pull_request` or `pull_request_target`.
150-
///
146+
/// The head ref or source branch of the pull request in a workflow run.
147+
///
148+
/// This property is only set when the event that triggers a workflow run is either
149+
/// `pull_request` or `pull_request_target`.
150+
///
151151
/// For example, feature-branch-1.
152-
///
152+
///
153153
/// From the `GITHUB_HEAD_REF` environment variable.
154154
String? get headRef => process.getEnv('GITHUB_HEAD_REF');
155155

156-
/// The short ref name of the branch or tag that triggered the workflow run.
157-
///
158-
/// This value matches the branch or tag name shown on GitHub.
159-
///
156+
/// The short ref name of the branch or tag that triggered the workflow run.
157+
///
158+
/// This value matches the branch or tag name shown on GitHub.
159+
///
160160
/// For example, `feature-branch-1`.
161-
///
161+
///
162162
/// From the `GITHUB_REF_NAME` environment variable.
163163
String get refName => process.getEnv('GITHUB_REF_NAME')!;
164164

165-
/// The type of ref that triggered the workflow run.
166-
///
165+
/// The type of ref that triggered the workflow run.
166+
///
167167
/// Valid values are `branch` or `tag`.
168-
///
168+
///
169169
/// From the `GITHUB_REF_TYPE` environment variable.
170170
GitHubRefType get refType => GitHubRefType.values.byName(
171-
process.getEnv('GITHUB_REF_TYPE')!,
172-
);
173-
174-
/// A unique number for each attempt of a particular workflow run in a repository.
175-
///
176-
/// This number begins at `1` for the workflow run's first attempt, and increments
177-
/// with each re-run.
178-
///
171+
process.getEnv('GITHUB_REF_TYPE')!,
172+
);
173+
174+
/// A unique number for each attempt of a particular workflow run in a repository.
175+
///
176+
/// This number begins at `1` for the workflow run's first attempt, and increments
177+
/// with each re-run.
178+
///
179179
/// For example, `3`.
180-
///
180+
///
181181
/// From the `GITHUB_RUN_ATTEMPT` environment variable.
182182
int get runAttempt => int.parse(process.getEnv('GITHUB_RUN_ATTEMPT')!);
183183

184184
/// The URL to this workflow's run.
185-
String get workflowRunUrl => '$serverUrl/${repo.owner}/${repo.repo}/actions/runs/$runId';
185+
String get workflowRunUrl =>
186+
'$serverUrl/${repo.owner}/${repo.repo}/actions/runs/$runId';
186187
}
187188

188189
enum GitHubRefType { branch, tag }
@@ -211,7 +212,7 @@ extension type WebhookPayload._(JSObject it) implements JSObject {
211212
@anonymous
212213
extension type PullRequest._(JSObject it) implements JSObject {
213214
external int get number;
214-
215+
215216
@JS('html_url')
216217
external String? get htmlUrl;
217218
external String? get body;

actions/lib/src/node/actions/http_request.dart

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@ extension type HttpClient._(JSObject it) {
1414
@JS('getJson')
1515
external JSPromise _getJson(String requestUrl, [JSObject headers]);
1616

17-
Future<Map<String, Object?>> getJson(String requestUrl, {
17+
Future<Map<String, Object?>> getJson(
18+
String requestUrl, {
1819
Map<String, String> headers = const {},
19-
} ) async {
20-
final jsHeaders = headers.jsify() as JSObject;
20+
}) async {
21+
final jsHeaders = headers.jsify() as JSObject;
2122
final response = await _getJson(requestUrl, jsHeaders).toDart;
2223
final result = response as TypedResponse<JSObject>;
2324
if (result.statusCode != 200) {

0 commit comments

Comments
 (0)