@computis/effect-github 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/LICENSE +23 -0
  3. package/README.md +79 -2
  4. package/dist/action-client.d.ts +38 -0
  5. package/dist/action-client.d.ts.map +1 -0
  6. package/dist/action-client.js +96 -0
  7. package/dist/action-client.js.map +1 -0
  8. package/dist/action-context.d.ts +51 -0
  9. package/dist/action-context.d.ts.map +1 -0
  10. package/dist/action-context.js +61 -0
  11. package/dist/action-context.js.map +1 -0
  12. package/dist/action-runner.d.ts +57 -0
  13. package/dist/action-runner.d.ts.map +1 -0
  14. package/dist/action-runner.js +100 -0
  15. package/dist/action-runner.js.map +1 -0
  16. package/dist/action-summary.d.ts +45 -0
  17. package/dist/action-summary.d.ts.map +1 -0
  18. package/dist/action-summary.js +92 -0
  19. package/dist/action-summary.js.map +1 -0
  20. package/dist/action.d.ts +16 -0
  21. package/dist/action.d.ts.map +1 -0
  22. package/dist/action.js +37 -0
  23. package/dist/action.js.map +1 -0
  24. package/dist/errors/action-api-error.d.ts +13 -0
  25. package/dist/errors/action-api-error.d.ts.map +1 -0
  26. package/dist/errors/action-api-error.js +17 -0
  27. package/dist/errors/action-api-error.js.map +1 -0
  28. package/dist/errors/action-context-error.d.ts +16 -0
  29. package/dist/errors/action-context-error.d.ts.map +1 -0
  30. package/dist/errors/action-context-error.js +16 -0
  31. package/dist/errors/action-context-error.js.map +1 -0
  32. package/dist/errors/action-failed.d.ts +10 -0
  33. package/dist/errors/action-failed.d.ts.map +1 -0
  34. package/dist/errors/action-failed.js +10 -0
  35. package/dist/errors/action-failed.js.map +1 -0
  36. package/dist/errors/action-failure.d.ts +15 -0
  37. package/dist/errors/action-failure.d.ts.map +1 -0
  38. package/dist/errors/action-failure.js +15 -0
  39. package/dist/errors/action-failure.js.map +1 -0
  40. package/dist/errors/action-input-error.d.ts +17 -0
  41. package/dist/errors/action-input-error.d.ts.map +1 -0
  42. package/dist/errors/action-input-error.js +22 -0
  43. package/dist/errors/action-input-error.js.map +1 -0
  44. package/dist/errors/action-oidc-error.d.ts +15 -0
  45. package/dist/errors/action-oidc-error.d.ts.map +1 -0
  46. package/dist/errors/action-oidc-error.js +18 -0
  47. package/dist/errors/action-oidc-error.js.map +1 -0
  48. package/dist/errors/action-summary-error.d.ts +15 -0
  49. package/dist/errors/action-summary-error.d.ts.map +1 -0
  50. package/dist/errors/action-summary-error.js +18 -0
  51. package/dist/errors/action-summary-error.js.map +1 -0
  52. package/dist/errors/input-validation-failure.d.ts +19 -0
  53. package/dist/errors/input-validation-failure.d.ts.map +1 -0
  54. package/dist/errors/input-validation-failure.js +19 -0
  55. package/dist/errors/input-validation-failure.js.map +1 -0
  56. package/dist/errors/platform-missing.d.ts +9 -0
  57. package/dist/errors/platform-missing.d.ts.map +1 -0
  58. package/dist/errors/platform-missing.js +9 -0
  59. package/dist/errors/platform-missing.js.map +1 -0
  60. package/dist/input.d.ts +14 -0
  61. package/dist/input.d.ts.map +1 -0
  62. package/dist/input.js +30 -0
  63. package/dist/input.js.map +1 -0
  64. package/dist/object.d.ts +2 -0
  65. package/dist/object.d.ts.map +1 -0
  66. package/dist/object.js +2 -0
  67. package/dist/object.js.map +1 -0
  68. package/dist/testing/action-client-test.d.ts +7 -0
  69. package/dist/testing/action-client-test.d.ts.map +1 -0
  70. package/dist/testing/action-client-test.js +10 -0
  71. package/dist/testing/action-client-test.js.map +1 -0
  72. package/dist/testing/action-context-test.d.ts +10 -0
  73. package/dist/testing/action-context-test.d.ts.map +1 -0
  74. package/dist/testing/action-context-test.js +27 -0
  75. package/dist/testing/action-context-test.js.map +1 -0
  76. package/dist/testing/action-runner-test.d.ts +26 -0
  77. package/dist/testing/action-runner-test.d.ts.map +1 -0
  78. package/dist/testing/action-runner-test.js +92 -0
  79. package/dist/testing/action-runner-test.js.map +1 -0
  80. package/dist/testing/action-summary-test.d.ts +11 -0
  81. package/dist/testing/action-summary-test.d.ts.map +1 -0
  82. package/dist/testing/action-summary-test.js +62 -0
  83. package/dist/testing/action-summary-test.js.map +1 -0
  84. package/dist/thrown-message.d.ts +2 -0
  85. package/dist/thrown-message.d.ts.map +1 -0
  86. package/dist/thrown-message.js +7 -0
  87. package/dist/thrown-message.js.map +1 -0
  88. package/package.json +64 -3
  89. package/src/action-client.ts +238 -0
  90. package/src/action-context.ts +121 -0
  91. package/src/action-runner.ts +221 -0
  92. package/src/action-summary.ts +143 -0
  93. package/src/action.ts +81 -0
  94. package/src/errors/action-api-error.ts +18 -0
  95. package/src/errors/action-context-error.ts +20 -0
  96. package/src/errors/action-failed.ts +10 -0
  97. package/src/errors/action-failure.ts +36 -0
  98. package/src/errors/action-input-error.ts +24 -0
  99. package/src/errors/action-oidc-error.ts +19 -0
  100. package/src/errors/action-summary-error.ts +22 -0
  101. package/src/errors/input-validation-failure.ts +23 -0
  102. package/src/errors/platform-missing.ts +9 -0
  103. package/src/input.ts +60 -0
  104. package/src/object.ts +4 -0
  105. package/src/testing/action-client-test.ts +15 -0
  106. package/src/testing/action-context-test.ts +36 -0
  107. package/src/testing/action-runner-test.ts +138 -0
  108. package/src/testing/action-summary-test.ts +82 -0
  109. package/src/thrown-message.ts +9 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,7 @@
1
+ # @computis/effect-github
2
+
3
+ ## 0.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`672601d`](https://github.com/computis-labs/oss/commit/672601d5a8c98c6efbae261cf1be77861198b3ac) Thanks [@Ceereals](https://github.com/Ceereals)! - First public release: write the logic of GitHub Actions with Effect 4. A port of `@effect-native/platform-github` with the runner, event context, Octokit client, job summary, schema-decoded inputs and `runMain`.
package/LICENSE ADDED
@@ -0,0 +1,23 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Effectful Technologies Inc (original work)
4
+ Copyright (c) 2025 effect-native contributors (modifications and packages-native/)
5
+ Copyright (c) 2026 Computis (port to Effect 4)
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ of this software and associated documentation files (the "Software"), to deal
9
+ in the Software without restriction, including without limitation the rights
10
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ copies of the Software, and to permit persons to whom the Software is
12
+ furnished to do so, subject to the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be included in all
15
+ copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,80 @@
1
- # Temporary Holding Version
1
+ # @computis/effect-github
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Write the logic of a GitHub Actions step with Effect: read inputs, write outputs and the job summary, read the event, call the GitHub API through Octokit, and fail the step with a readable message.
4
+
5
+ It is a port to Effect 4 of [`@effect-native/platform-github`](https://github.com/effect-native/effect-native/tree/tom/platform-github/packages-native/platform-github), which targets Effect 3. The API follows it; [Differences from upstream](#differences-from-upstream) lists where it departs.
6
+
7
+ ## Install
8
+
9
+ ```sh
10
+ npm install @computis/effect-github effect @effect/platform-node
11
+ ```
12
+
13
+ It needs Effect 4 and Node 22 or later, and ships as ESM only. It runs on Node only: `@actions/core` and `@actions/github` underneath are Node libraries. `runMain` loads `@effect/platform-node` when it starts and fails the step with a message naming it when it is not installed; the other modules do not need it.
14
+
15
+ ## Use
16
+
17
+ | Module | Holds |
18
+ | ---------------- | ------------------------------------------------------------------------------------------------------------------------ |
19
+ | `action` | `runMain`, `layer`, `layerConfig`, `makeRuntime` |
20
+ | `action-runner` | `ActionRunner`: inputs, outputs, annotations, groups, state, secrets, OIDC (`@actions/core`) |
21
+ | `action-context` | `ActionContext`: event, repository, run; `decodePayload` decodes the event with a schema |
22
+ | `action-client` | `ActionClient`: `octokit`, `request`, `graphql`, `paginate`, and `*Decoded` variants that decode with a schema |
23
+ | `action-summary` | `ActionSummary`: the job summary builder |
24
+ | `input` | `Input`: action inputs decoded by a schema (`integer`, `boolean`, `json`, `secret`, …) |
25
+ | `errors/*` | One tagged error per module, `ActionFailed` to fail the step, `action-failure` for `isActionError` and `isActionFailure` |
26
+ | `testing/*` | `ActionRunnerTest`, `ActionContextTest`, `ActionClientTest`, `ActionSummaryTest`: `make` and a default `layer` each |
27
+
28
+ ```ts
29
+ import { runMain } from "@computis/effect-github/action";
30
+ import { ActionRunner } from "@computis/effect-github/action-runner";
31
+ import { ActionFailed } from "@computis/effect-github/errors/action-failed";
32
+ import { Config, Effect } from "effect";
33
+
34
+ runMain(
35
+ Effect.gen(function* publishVerdict() {
36
+ const runner = yield* ActionRunner;
37
+ const result = yield* Config.String("RESULT");
38
+ yield* runner.setOutput("verdict", result);
39
+ if (result === "block") {
40
+ return yield* new ActionFailed({ message: "The review found blocking issues." });
41
+ }
42
+ }),
43
+ );
44
+ ```
45
+
46
+ `runMain` provides every service, reports the failure with `core.setFailed` and exits with 1.
47
+ The client reads its token from `INPUT_GITHUB_TOKEN`, then `GITHUB_TOKEN`; without one, it sends
48
+ anonymous requests, and GitHub answers 401 or 404 for what needs a token. `paginate` stops at
49
+ 100 pages unless `maxPages` says otherwise, and fails when the collection is longer.
50
+
51
+ Every service method also has a module-level accessor, as in upstream: `getInput`, `setOutput`,
52
+ `group`, `eventName`, `repo`, `request`, `write` and the rest.
53
+
54
+ A step started with `run: node script.ts` has no action inputs: GitHub sets `INPUT_*` only for a
55
+ `uses:` action. Read what the step passes through `env:` with `Config`.
56
+
57
+ ## Differences from upstream
58
+
59
+ The API follows upstream. These parts differ on purpose:
60
+
61
+ | Upstream | Here |
62
+ | --------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
63
+ | `request<T>`, `graphql<T>`, `paginate<T>` cast to `T` | They return JSON values; `requestDecoded`, `graphqlDecoded`, `paginateDecoded` decode with a schema |
64
+ | `paginate` follows every page | It stops at `maxPages` (100 by default) and fails beyond it |
65
+ | `getOctokit("")` throws without a token | The client sends anonymous requests |
66
+ | A missing required input throws a defect | `getInput` and `getMultilineInput` fail with `ActionInputError` `Missing` |
67
+ | `setOutput` and `saveState` take `unknown` | They take a JSON value |
68
+ | `getIDToken` returns a string | It returns a `Redacted` token |
69
+ | `ActionClientTest` takes canned Octokit results | `ActionClientTest.make({ fetch })` runs the real Octokit over a fake `fetch` |
70
+ | `ActionRunnerTest.make` returns record fields and `getFailed()` | It returns `{ layer, recording }`: `recording` holds `outputs`, `state`, `variables` as `Map`s and `failures`, `logs`, `groups`, `secrets`, `paths` as arrays |
71
+ | `ActionContextTest` fails `repo` and `issue` from an `Error` | It takes an `ActionContextError`, the error the live layer fails with |
72
+ | `ActionSummaryTest` fails `write` and `clear` from an `Error` | It takes the description of the `ActionSummaryError` to fail with |
73
+ | — | `decodePayload(schema)` decodes the event payload; `ActionClient.layer` takes Octokit options |
74
+
75
+ The summary builder stays synchronous, as upstream: `addHeading` and the other `add*` methods only fill
76
+ an in-memory buffer, and `write` and `clear`, which touch the file, return an Effect.
77
+
78
+ ## License
79
+
80
+ MIT. The package is a derivative work of `@effect-native/platform-github`: [LICENSE](LICENSE) keeps its copyright notices, Effectful Technologies Inc and the effect-native contributors, next to Computis.
@@ -0,0 +1,38 @@
1
+ import { getOctokit } from "@actions/github";
2
+ import { Config, Context, Effect, Layer, Redacted, Schema } from "effect";
3
+ import { ActionApiError } from "./errors/action-api-error.ts";
4
+ export type Octokit = ReturnType<typeof getOctokit>;
5
+ export type OctokitOptions = NonNullable<Parameters<typeof getOctokit>[1]>;
6
+ export type RequestParameters = Readonly<Record<string, Schema.Json>>;
7
+ export type RestResponse = Omit<Awaited<ReturnType<Octokit["request"]>>, "data"> & {
8
+ readonly data: Schema.Json;
9
+ };
10
+ export interface PaginateOptions {
11
+ readonly maxPages?: number;
12
+ }
13
+ export interface ActionClientApi {
14
+ readonly octokit: Octokit;
15
+ readonly call: <A>(method: string, run: (octokit: Octokit) => Promise<A>) => Effect.Effect<A, ActionApiError>;
16
+ readonly request: (route: string, parameters?: RequestParameters) => Effect.Effect<RestResponse, ActionApiError>;
17
+ readonly graphql: (query: string, variables?: RequestParameters) => Effect.Effect<Schema.Json, ActionApiError>;
18
+ readonly paginate: (route: string, parameters?: RequestParameters, options?: PaginateOptions) => Effect.Effect<readonly Schema.Json[], ActionApiError>;
19
+ readonly requestDecoded: <S extends Schema.Top>(schema: S, route: string, parameters?: RequestParameters) => Effect.Effect<S["Type"], ActionApiError, S["DecodingServices"]>;
20
+ readonly graphqlDecoded: <S extends Schema.Top>(schema: S, query: string, variables?: RequestParameters) => Effect.Effect<S["Type"], ActionApiError, S["DecodingServices"]>;
21
+ readonly paginateDecoded: <S extends Schema.Top>(schema: S, route: string, parameters?: RequestParameters, options?: PaginateOptions) => Effect.Effect<readonly S["Type"][], ActionApiError, S["DecodingServices"]>;
22
+ }
23
+ declare const ActionClient_base: Context.ServiceClass<ActionClient, "@computis/effect-github/ActionClient", ActionClientApi>;
24
+ export declare class ActionClient extends ActionClient_base {
25
+ static readonly layer: (token: Redacted.Redacted, options?: OctokitOptions) => Layer.Layer<ActionClient, never, never>;
26
+ static readonly layerConfig: Layer.Layer<ActionClient, Config.ConfigError, never>;
27
+ }
28
+ export declare const octokit: Effect.Effect<Octokit, never, ActionClient>;
29
+ export declare const request: (route: string, parameters?: RequestParameters) => Effect.Effect<RestResponse, ActionApiError, ActionClient>;
30
+ export declare const graphql: (query: string, variables?: RequestParameters) => Effect.Effect<Schema.Json, ActionApiError, ActionClient>;
31
+ export declare const paginate: (route: string, parameters?: RequestParameters, options?: PaginateOptions) => Effect.Effect<readonly Schema.Json[], ActionApiError, ActionClient>;
32
+ export declare const layer: (token: Redacted.Redacted, options?: OctokitOptions) => Layer.Layer<ActionClient, never, never>, layerConfig: Layer.Layer<ActionClient, Config.ConfigError, never>;
33
+ export declare const call: <A>(method: string, run: (octokit: Octokit) => Promise<A>) => Effect.Effect<A, ActionApiError, ActionClient>;
34
+ export declare const requestDecoded: <S extends Schema.Top>(schema: S, route: string, parameters?: RequestParameters) => Effect.Effect<S["Type"], ActionApiError, ActionClient | S["DecodingServices"]>;
35
+ export declare const graphqlDecoded: <S extends Schema.Top>(schema: S, query: string, variables?: RequestParameters) => Effect.Effect<S["Type"], ActionApiError, ActionClient | S["DecodingServices"]>;
36
+ export declare const paginateDecoded: <S extends Schema.Top>(schema: S, route: string, parameters?: RequestParameters, options?: PaginateOptions) => Effect.Effect<readonly S["Type"][], ActionApiError, ActionClient | S["DecodingServices"]>;
37
+ export {};
38
+ //# sourceMappingURL=action-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"action-client.d.ts","sourceRoot":"","sources":["../src/action-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAI7C,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAQ,KAAK,EAAU,QAAQ,EAAE,MAAM,EAAU,MAAM,QAAQ,CAAC;AAChG,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9D,MAAM,MAAM,OAAO,GAAG,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC;AAEpD,MAAM,MAAM,cAAc,GAAG,WAAW,CAAC,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAE3E,MAAM,MAAM,iBAAiB,GAAG,QA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AAC,QAAQ,YAAY,cAAc,8CAiCvD,WAAW,sDAAiB,CAAC;AAEnD,eAAO,MAAM,IAAI,GAAI,CAAC,UAAU,MAAM,OAAO,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,CAAC,CAAC,mDACR,CAAC;AAEtE,eAAO,MAAM,cAAc,GAAI,CAAC,SAAS,MAAM,CAAC,GAAG,UACzC,CAAC,SACF,MAAM,eACA,iBAAiB,mFACgE,CAAC;AAEjG,eAAO,MAAM,cAAc,GAAI,CAAC,SAAS,MAAM,CAAC,GAAG,UACzC,CAAC,SACF,MAAM,cACD,iBAAiB,mFACgE,CAAC;AAEhG,eAAO,MAAM,eAAe,GAAI,CAAC,SAAS,MAAM,CAAC,GAAG,UAC1C,CAAC,SACF,MAAM,eACA,iBAAiB,YACpB,eAAe,8FAIxB,CAAC"}
@@ -0,0 +1,96 @@
1
+ import { getOctokit } from "@actions/github";
2
+ import { GitHub } from "@actions/github/lib/utils";
3
+ import { whenDefined } from "./object.js";
4
+ import { thrownMessage } from "./thrown-message.js";
5
+ import { Config, Context, Effect, flow, Layer, Option, Redacted, Schema, Stream } from "effect";
6
+ import { ActionApiError } from "./errors/action-api-error.js";
7
+ const defaultMaxPages = 100;
8
+ const decodeMaxPages = Schema.decodeUnknownEffect(Schema.Int.check(Schema.isGreaterThanOrEqualTo(1)));
9
+ const decodeHttpStatus = Schema.decodeUnknownOption(Schema.Struct({ status: Schema.Number }));
10
+ const decodeResponse = (schema, method) => flow(Schema.decodeUnknownEffect(schema), Effect.mapError((cause) => new ActionApiError({ cause, description: `unexpected response: ${cause.message}`, method })));
11
+ const requestFailed = (method) => (cause) => cause instanceof ActionApiError
12
+ ? cause
13
+ : new ActionApiError({
14
+ cause,
15
+ description: thrownMessage(cause, "the request failed"),
16
+ method,
17
+ ...whenDefined(Option.getOrUndefined(decodeHttpStatus(cause)), ({ status }) => ({
18
+ status,
19
+ })),
20
+ });
21
+ const make = (token, options = {}) => {
22
+ const secret = Redacted.value(token);
23
+ const octokit = secret === "" ? new GitHub(options) : getOctokit(secret, options);
24
+ const call = Effect.fn("ActionClient.call")(function* call(method, run) {
25
+ return yield* Effect.tryPromise({
26
+ catch: requestFailed(method),
27
+ try: async () => await run(octokit),
28
+ });
29
+ });
30
+ const request = Effect.fn("ActionClient.request")(function* request(route, parameters) {
31
+ const response = yield* call(route, async (client) => await client.request(route, parameters));
32
+ const data = yield* decodeResponse(Schema.Json, route)(response.data);
33
+ const restResponse = { ...response, data };
34
+ return restResponse;
35
+ });
36
+ const graphql = Effect.fn("ActionClient.graphql")(function* graphql(query, variables) {
37
+ const data = yield* call("graphql", async (client) => await client.graphql(query, variables));
38
+ return yield* decodeResponse(Schema.Json, "graphql")(data);
39
+ });
40
+ const paginate = Effect.fn("ActionClient.paginate")(function* paginate(route, parameters, paginateOptions = {}) {
41
+ const maxPages = yield* decodeMaxPages(paginateOptions.maxPages ?? defaultMaxPages).pipe(Effect.mapError((cause) => new ActionApiError({
42
+ cause,
43
+ description: `maxPages must be a positive integer: ${cause.message}`,
44
+ method: route,
45
+ })));
46
+ const iterator = yield* Effect.try({
47
+ catch: requestFailed(route),
48
+ try: () => octokit.paginate.iterator(route, parameters),
49
+ });
50
+ const pages = yield* Stream.fromAsyncIterable(iterator, requestFailed(route)).pipe(Stream.take(maxPages + 1), Stream.runCollect);
51
+ if (pages.length > maxPages) {
52
+ return yield* new ActionApiError({
53
+ description: `more than ${maxPages} pages`,
54
+ method: route,
55
+ });
56
+ }
57
+ return yield* decodeResponse(Schema.Array(Schema.Json), route)(pages.flatMap((page) => page.data));
58
+ });
59
+ return {
60
+ call,
61
+ graphql,
62
+ graphqlDecoded: Effect.fn("ActionClient.graphqlDecoded")(function* graphqlDecoded(schema, query, variables) {
63
+ const data = yield* graphql(query, variables);
64
+ return yield* decodeResponse(schema, "graphql")(data);
65
+ }),
66
+ octokit,
67
+ paginate,
68
+ paginateDecoded: Effect.fn("ActionClient.paginateDecoded")(function* paginateDecoded(schema, route, parameters, paginateOptions) {
69
+ const items = yield* paginate(route, parameters, paginateOptions);
70
+ return yield* decodeResponse(Schema.Array(schema), route)(items);
71
+ }),
72
+ request,
73
+ requestDecoded: Effect.fn("ActionClient.requestDecoded")(function* requestDecoded(schema, route, parameters) {
74
+ const { data } = yield* request(route, parameters);
75
+ return yield* decodeResponse(schema, route)(data);
76
+ }),
77
+ };
78
+ };
79
+ export class ActionClient extends Context.Service()("@computis/effect-github/ActionClient") {
80
+ static layer = (token, options) => Layer.sync(ActionClient, () => make(token, options));
81
+ static layerConfig = Layer.effect(ActionClient, Effect.gen(function* makeActionClientFromConfig() {
82
+ const token = yield* Config.Redacted("INPUT_GITHUB_TOKEN").pipe(Config.orElse(() => Config.Redacted("GITHUB_TOKEN")), Config.withDefault(Redacted.make("")));
83
+ return make(token);
84
+ }));
85
+ }
86
+ const client = Effect.service(ActionClient);
87
+ export const octokit = client.pipe(Effect.map((service) => service.octokit));
88
+ export const request = (route, parameters) => client.pipe(Effect.flatMap((service) => service.request(route, parameters)));
89
+ export const graphql = (query, variables) => client.pipe(Effect.flatMap((service) => service.graphql(query, variables)));
90
+ export const paginate = (route, parameters, options) => client.pipe(Effect.flatMap((service) => service.paginate(route, parameters, options)));
91
+ export const { layer, layerConfig } = ActionClient;
92
+ export const call = (method, run) => client.pipe(Effect.flatMap((service) => service.call(method, run)));
93
+ export const requestDecoded = (schema, route, parameters) => client.pipe(Effect.flatMap((service) => service.requestDecoded(schema, route, parameters)));
94
+ export const graphqlDecoded = (schema, query, variables) => client.pipe(Effect.flatMap((service) => service.graphqlDecoded(schema, query, variables)));
95
+ export const paginateDecoded = (schema, route, parameters, options) => client.pipe(Effect.flatMap((service) => service.paginateDecoded(schema, route, parameters, options)));
96
+ //# sourceMappingURL=action-client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"action-client.js","sourceRoot":"","sources":["../src/action-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC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a,EACb,UAA8B,EAC9B,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,cAAc,CAAC,MAAM,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC;AAEjG,MAAM,CAAC,MAAM,cAAc,GAAG,CAC5B,MAAS,EACT,KAAa,EACb,SAA6B,EAC7B,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,cAAc,CAAC,MAAM,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;AAEhG,MAAM,CAAC,MAAM,eAAe,GAAG,CAC7B,MAAS,EACT,KAAa,EACb,UAA8B,EAC9B,OAAyB,EACzB,EAAE,CACF,MAAM,CAAC,IAAI,CACT,MAAM,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,eAAe,CAAC,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC,CACzF,CAAC"}
@@ -0,0 +1,51 @@
1
+ import { Context, Effect, Layer, Schema } from "effect";
2
+ import { ActionContextError } from "./errors/action-context-error.ts";
3
+ export interface RepoContext {
4
+ readonly owner: string;
5
+ readonly repo: string;
6
+ }
7
+ export interface IssueContext extends RepoContext {
8
+ readonly number: number;
9
+ }
10
+ export interface ActionContextApi {
11
+ readonly eventName: string;
12
+ readonly payload: unknown;
13
+ readonly workflow: string;
14
+ readonly action: string;
15
+ readonly actor: string;
16
+ readonly job: string;
17
+ readonly runId: number;
18
+ readonly runNumber: number;
19
+ readonly runAttempt: number;
20
+ readonly ref: string;
21
+ readonly sha: string;
22
+ readonly apiUrl: string;
23
+ readonly serverUrl: string;
24
+ readonly graphqlUrl: string;
25
+ readonly repo: Effect.Effect<RepoContext, ActionContextError>;
26
+ readonly issue: Effect.Effect<IssueContext, ActionContextError>;
27
+ }
28
+ declare const ActionContext_base: Context.ServiceClass<ActionContext, "@computis/effect-github/ActionContext", ActionContextApi>;
29
+ export declare class ActionContext extends ActionContext_base {
30
+ static readonly layer: Layer.Layer<ActionContext, never, never>;
31
+ }
32
+ export declare const decodePayload: <S extends Schema.Top>(schema: S) => Effect.Effect<S["Type"], ActionContextError, ActionContext | S["DecodingServices"]>;
33
+ export declare const eventName: Effect.Effect<string, never, ActionContext>;
34
+ export declare const payload: Effect.Effect<unknown, never, ActionContext>;
35
+ export declare const workflow: Effect.Effect<string, never, ActionContext>;
36
+ export declare const action: Effect.Effect<string, never, ActionContext>;
37
+ export declare const actor: Effect.Effect<string, never, ActionContext>;
38
+ export declare const job: Effect.Effect<string, never, ActionContext>;
39
+ export declare const runId: Effect.Effect<number, never, ActionContext>;
40
+ export declare const runNumber: Effect.Effect<number, never, ActionContext>;
41
+ export declare const runAttempt: Effect.Effect<number, never, ActionContext>;
42
+ export declare const ref: Effect.Effect<string, never, ActionContext>;
43
+ export declare const sha: Effect.Effect<string, never, ActionContext>;
44
+ export declare const apiUrl: Effect.Effect<string, never, ActionContext>;
45
+ export declare const serverUrl: Effect.Effect<string, never, ActionContext>;
46
+ export declare const graphqlUrl: Effect.Effect<string, never, ActionContext>;
47
+ export declare const repo: Effect.Effect<RepoContext, ActionContextError, ActionContext>;
48
+ export declare const issue: Effect.Effect<IssueContext, ActionContextError, ActionContext>;
49
+ export declare const layer: Layer.Layer<ActionContext, never, never>;
50
+ export {};
51
+ //# sourceMappingURL=action-context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"action-context.d.ts","sourceRoot":"","sources":["../src/action-context.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAA4B,MAAM,kCAAkC,CAAC;AAEhG,MAAM,WAAW,WAAW;IAC1B,QAAQ,CA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eAAO,MAAM,QAAQ,6CAAgE,CAAC;AAEtF,eAAO,MAAM,MAAM,6CAA8D,CAAC;AAElF,eAAO,MAAM,KAAK,6CAA6D,CAAC;AAEhF,eAAO,MAAM,GAAG,6CAA2D,CAAC;AAE5E,eAAO,MAAM,KAAK,6CAA6D,CAAC;AAEhF,eAAO,MAAM,SAAS,6CAAiE,CAAC;AAExF,eAAO,MAAM,UAAU,6CAAkE,CAAC;AAE1F,eAAO,MAAM,GAAG,6CAA2D,CAAC;AAE5E,eAAO,MAAM,GAAG,6CAA2D,CAAC;AAE5E,eAAO,MAAM,MAAM,6CAA8D,CAAC;AAElF,eAAO,MAAM,SAAS,6CAAiE,CAAC;AAExF,eAAO,MAAM,UAAU,6CAAkE,CAAC;AAE1F,eAAO,MAAM,IAAI,+DAAgE,CAAC;AAElF,eAAO,MAAM,KAAK,gEAAiE,CAAC;AAEpF,eAAO,MAAQ,KAAK,0CAAkB,CAAC"}
@@ -0,0 +1,61 @@
1
+ import { context } from "@actions/github";
2
+ import { thrownMessage } from "./thrown-message.js";
3
+ import { Context, Effect, Layer, Schema } from "effect";
4
+ import { ActionContextError, ActionContextErrorReason } from "./errors/action-context-error.js";
5
+ const readRepository = Effect.fn("ActionContext.readRepository")(function* readRepository(read) {
6
+ return yield* Effect.try({
7
+ catch: (cause) => new ActionContextError({
8
+ cause,
9
+ description: thrownMessage(cause, "GITHUB_REPOSITORY is not set"),
10
+ reason: ActionContextErrorReason.InvalidRepo,
11
+ }),
12
+ try: read,
13
+ });
14
+ });
15
+ export class ActionContext extends Context.Service()("@computis/effect-github/ActionContext") {
16
+ static layer = Layer.sync(ActionContext, () => ({
17
+ action: context.action,
18
+ actor: context.actor,
19
+ apiUrl: context.apiUrl,
20
+ eventName: context.eventName,
21
+ graphqlUrl: context.graphqlUrl,
22
+ issue: readRepository(() => context.issue),
23
+ job: context.job,
24
+ payload: context.payload,
25
+ ref: context.ref,
26
+ repo: readRepository(() => context.repo),
27
+ runAttempt: context.runAttempt,
28
+ runId: context.runId,
29
+ runNumber: context.runNumber,
30
+ serverUrl: context.serverUrl,
31
+ sha: context.sha,
32
+ workflow: context.workflow,
33
+ }));
34
+ }
35
+ export const decodePayload = Effect.fn("ActionContext.decodePayload")(function* decodePayload(schema) {
36
+ const current = yield* ActionContext;
37
+ return yield* Schema.decodeUnknownEffect(schema)(current.payload).pipe(Effect.mapError((cause) => new ActionContextError({
38
+ cause,
39
+ description: `The ${current.eventName} payload does not match: ${cause.message}`,
40
+ reason: ActionContextErrorReason.InvalidPayload,
41
+ })));
42
+ });
43
+ const actionContext = Effect.service(ActionContext);
44
+ export const eventName = actionContext.pipe(Effect.map((current) => current.eventName));
45
+ export const payload = actionContext.pipe(Effect.map((current) => current.payload));
46
+ export const workflow = actionContext.pipe(Effect.map((current) => current.workflow));
47
+ export const action = actionContext.pipe(Effect.map((current) => current.action));
48
+ export const actor = actionContext.pipe(Effect.map((current) => current.actor));
49
+ export const job = actionContext.pipe(Effect.map((current) => current.job));
50
+ export const runId = actionContext.pipe(Effect.map((current) => current.runId));
51
+ export const runNumber = actionContext.pipe(Effect.map((current) => current.runNumber));
52
+ export const runAttempt = actionContext.pipe(Effect.map((current) => current.runAttempt));
53
+ export const ref = actionContext.pipe(Effect.map((current) => current.ref));
54
+ export const sha = actionContext.pipe(Effect.map((current) => current.sha));
55
+ export const apiUrl = actionContext.pipe(Effect.map((current) => current.apiUrl));
56
+ export const serverUrl = actionContext.pipe(Effect.map((current) => current.serverUrl));
57
+ export const graphqlUrl = actionContext.pipe(Effect.map((current) => current.graphqlUrl));
58
+ export const repo = actionContext.pipe(Effect.flatMap((current) => current.repo));
59
+ export const issue = actionContext.pipe(Effect.flatMap((current) => current.issue));
60
+ export const { layer } = ActionContext;
61
+ //# sourceMappingURL=action-context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"action-context.js","sourceRoot":"","sources":["../src/action-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,iBA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O,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;AAE5E,MAAM,CAAC,MAAM,MAAM,GAAG,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;AAElF,MAAM,CAAC,MAAM,SAAS,GAAG,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC;AAExF,MAAM,CAAC,MAAM,UAAU,GAAG,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC;AAE1F,MAAM,CAAC,MAAM,IAAI,GAAG,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;AAElF,MAAM,CAAC,MAAM,KAAK,GAAG,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;AAEpF,MAAM,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,aAAa,CAAC"}
@@ -0,0 +1,57 @@
1
+ import * as core from "@actions/core";
2
+ import { Context, Effect, Layer, Redacted } from "effect";
3
+ import type { Schema } from "effect";
4
+ import { ActionInputError } from "./errors/action-input-error.ts";
5
+ import { ActionOIDCError } from "./errors/action-oidc-error.ts";
6
+ export interface InputOptions {
7
+ readonly required?: boolean;
8
+ readonly trimWhitespace?: boolean;
9
+ }
10
+ export type AnnotationProperties = core.AnnotationProperties;
11
+ export interface ActionRunnerApi {
12
+ readonly getInput: (name: string, options?: InputOptions) => Effect.Effect<string, ActionInputError>;
13
+ readonly getMultilineInput: (name: string, options?: InputOptions) => Effect.Effect<readonly string[], ActionInputError>;
14
+ readonly getBooleanInput: (name: string, options?: InputOptions) => Effect.Effect<boolean, ActionInputError>;
15
+ readonly setOutput: (name: string, value: Schema.Json) => Effect.Effect<void>;
16
+ readonly debug: (message: string) => Effect.Effect<void>;
17
+ readonly info: (message: string) => Effect.Effect<void>;
18
+ readonly warning: (message: string | Error, properties?: AnnotationProperties) => Effect.Effect<void>;
19
+ readonly error: (message: string | Error, properties?: AnnotationProperties) => Effect.Effect<void>;
20
+ readonly notice: (message: string | Error, properties?: AnnotationProperties) => Effect.Effect<void>;
21
+ readonly startGroup: (name: string) => Effect.Effect<void>;
22
+ readonly endGroup: () => Effect.Effect<void>;
23
+ readonly group: <A, E, R>(name: string, fn: () => Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>;
24
+ readonly exportVariable: (name: string, value: string) => Effect.Effect<void>;
25
+ readonly addPath: (path: string) => Effect.Effect<void>;
26
+ readonly setSecret: (secret: string) => Effect.Effect<void>;
27
+ readonly saveState: (name: string, value: Schema.Json) => Effect.Effect<void>;
28
+ readonly getState: (name: string) => Effect.Effect<string>;
29
+ readonly setFailed: (message: string | Error) => Effect.Effect<void>;
30
+ readonly getIDToken: (audience?: string) => Effect.Effect<Redacted.Redacted, ActionOIDCError>;
31
+ }
32
+ declare const ActionRunner_base: Context.ServiceClass<ActionRunner, "@computis/effect-github/ActionRunner", ActionRunnerApi>;
33
+ export declare class ActionRunner extends ActionRunner_base {
34
+ static readonly layer: Layer.Layer<ActionRunner, never, never>;
35
+ }
36
+ export declare const getInput: (name: string, options?: InputOptions) => Effect.Effect<string, ActionInputError, ActionRunner>;
37
+ export declare const getMultilineInput: (name: string, options?: InputOptions) => Effect.Effect<readonly string[], ActionInputError, ActionRunner>;
38
+ export declare const getBooleanInput: (name: string, options?: InputOptions) => Effect.Effect<boolean, ActionInputError, ActionRunner>;
39
+ export declare const setOutput: (name: string, value: Schema.Json) => Effect.Effect<void, never, ActionRunner>;
40
+ export declare const debug: (message: string) => Effect.Effect<void, never, ActionRunner>;
41
+ export declare const info: (message: string) => Effect.Effect<void, never, ActionRunner>;
42
+ export declare const warning: (message: string | Error, properties?: AnnotationProperties) => Effect.Effect<void, never, ActionRunner>;
43
+ export declare const error: (message: string | Error, properties?: AnnotationProperties) => Effect.Effect<void, never, ActionRunner>;
44
+ export declare const notice: (message: string | Error, properties?: AnnotationProperties) => Effect.Effect<void, never, ActionRunner>;
45
+ export declare const startGroup: (name: string) => Effect.Effect<void, never, ActionRunner>;
46
+ export declare const endGroup: Effect.Effect<void, never, ActionRunner>;
47
+ export declare const group: <A, E, R>(name: string, fn: () => Effect.Effect<A, E, R>) => Effect.Effect<A, E, R | ActionRunner>;
48
+ export declare const exportVariable: (name: string, value: string) => Effect.Effect<void, never, ActionRunner>;
49
+ export declare const addPath: (path: string) => Effect.Effect<void, never, ActionRunner>;
50
+ export declare const setSecret: (secret: string) => Effect.Effect<void, never, ActionRunner>;
51
+ export declare const saveState: (name: string, value: Schema.Json) => Effect.Effect<void, never, ActionRunner>;
52
+ export declare const getState: (name: string) => Effect.Effect<string, never, ActionRunner>;
53
+ export declare const setFailed: (message: string | Error) => Effect.Effect<void, never, ActionRunner>;
54
+ export declare const getIDToken: (audience?: string) => Effect.Effect<Redacted.Redacted<string>, ActionOIDCError, ActionRunner>;
55
+ export declare const layer: Layer.Layer<ActionRunner, never, never>;
56
+ export {};
57
+ //# sourceMappingURL=action-runner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"action-runner.d.ts","sourceRoot":"","sources":["../src/action-runner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,eAAe,CAAC;AAEtC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAC1D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACrC,OAAO,EAAE,gBAAgB,EAA0B,MAA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AAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,0CACV,CAAC;AAEpE,eAAO,MAAM,cAAc,SAAU,MAAM,SAAS,MAAM,6CACqB,CAAC;AAEhF,eAAO,MAAM,OAAO,SAAU,MAAM,6CAC6B,CAAC;AAElE,eAAO,MAAM,SAAS,WAAY,MAAM,6CAC6B,CAAC;AAEtE,eAAO,MAAM,SAAS,SAAU,MAAM,SAAS,MAAM,CAAC,IAAI,6CACgB,CAAC;AAE3E,eAAO,MAAM,QAAQ,SAAU,MAAM,+CAC6B,CAAC;AAEnE,eAAO,MAAM,SAAS,YAAa,MAAM,GAAG,KAAK,6CACqB,CAAC;AAEvE,eAAO,MAAM,UAAU,cAAe,MAAM,4EAC4B,CAAC;AAEzE,eAAO,MAAQ,KAAK,yCAAiB,CAAC"}
@@ -0,0 +1,100 @@
1
+ import * as core from "@actions/core";
2
+ import { thrownMessage } from "./thrown-message.js";
3
+ import { Context, Effect, Layer, Redacted } from "effect";
4
+ import { ActionInputError, ActionInputErrorReason } from "./errors/action-input-error.js";
5
+ import { ActionOIDCError, ActionOIDCErrorReason } from "./errors/action-oidc-error.js";
6
+ const readInput = Effect.fn("ActionRunner.readInput")(function* readInput(name, read) {
7
+ return yield* Effect.try({
8
+ catch: (cause) => new ActionInputError({ cause, name, reason: ActionInputErrorReason.Missing }),
9
+ try: read,
10
+ });
11
+ });
12
+ export class ActionRunner extends Context.Service()("@computis/effect-github/ActionRunner") {
13
+ static layer = Layer.succeed(ActionRunner, {
14
+ addPath: (path) => Effect.sync(() => {
15
+ core.addPath(path);
16
+ }),
17
+ debug: (message) => Effect.sync(() => {
18
+ core.debug(message);
19
+ }),
20
+ endGroup: () => Effect.sync(() => {
21
+ core.endGroup();
22
+ }),
23
+ error: (message, properties) => Effect.sync(() => {
24
+ core.error(message, properties);
25
+ }),
26
+ exportVariable: (name, value) => Effect.sync(() => {
27
+ core.exportVariable(name, value);
28
+ }),
29
+ getBooleanInput: Effect.fn("ActionRunner.getBooleanInput")(function* getBooleanInput(name, options) {
30
+ return yield* Effect.try({
31
+ catch: (cause) => new ActionInputError({ cause, name, reason: ActionInputErrorReason.InvalidType }),
32
+ try: () => core.getBooleanInput(name, options),
33
+ });
34
+ }),
35
+ getIDToken: Effect.fn("ActionRunner.getIDToken")(function* getIDToken(audience) {
36
+ return yield* Effect.tryPromise({
37
+ catch: (cause) => new ActionOIDCError({
38
+ cause,
39
+ description: thrownMessage(cause, "the token request was rejected"),
40
+ reason: ActionOIDCErrorReason.RequestFailed,
41
+ }),
42
+ try: async () => Redacted.make(await core.getIDToken(audience)),
43
+ });
44
+ }),
45
+ getInput: (name, options) => readInput(name, () => core.getInput(name, options)),
46
+ getMultilineInput: (name, options) => readInput(name, () => core.getMultilineInput(name, options)),
47
+ getState: (name) => Effect.sync(() => core.getState(name)),
48
+ group: (name, fn) => Effect.acquireUseRelease(Effect.sync(() => {
49
+ core.startGroup(name);
50
+ }), fn, () => Effect.sync(() => {
51
+ core.endGroup();
52
+ })).pipe(Effect.withSpan("ActionRunner.group", { attributes: { group: name } })),
53
+ info: (message) => Effect.sync(() => {
54
+ core.info(message);
55
+ }),
56
+ notice: (message, properties) => Effect.sync(() => {
57
+ core.notice(message, properties);
58
+ }),
59
+ saveState: (name, value) => Effect.sync(() => {
60
+ core.saveState(name, value);
61
+ }),
62
+ setFailed: (message) => Effect.sync(() => {
63
+ core.setFailed(message);
64
+ }),
65
+ setOutput: (name, value) => Effect.sync(() => {
66
+ core.setOutput(name, value);
67
+ }),
68
+ setSecret: (secret) => Effect.sync(() => {
69
+ core.setSecret(secret);
70
+ }),
71
+ startGroup: (name) => Effect.sync(() => {
72
+ core.startGroup(name);
73
+ }),
74
+ warning: (message, properties) => Effect.sync(() => {
75
+ core.warning(message, properties);
76
+ }),
77
+ });
78
+ }
79
+ const runner = Effect.service(ActionRunner);
80
+ export const getInput = (name, options) => runner.pipe(Effect.flatMap((service) => service.getInput(name, options)));
81
+ export const getMultilineInput = (name, options) => runner.pipe(Effect.flatMap((service) => service.getMultilineInput(name, options)));
82
+ export const getBooleanInput = (name, options) => runner.pipe(Effect.flatMap((service) => service.getBooleanInput(name, options)));
83
+ export const setOutput = (name, value) => runner.pipe(Effect.flatMap((service) => service.setOutput(name, value)));
84
+ export const debug = (message) => runner.pipe(Effect.flatMap((service) => service.debug(message)));
85
+ export const info = (message) => runner.pipe(Effect.flatMap((service) => service.info(message)));
86
+ export const warning = (message, properties) => runner.pipe(Effect.flatMap((service) => service.warning(message, properties)));
87
+ export const error = (message, properties) => runner.pipe(Effect.flatMap((service) => service.error(message, properties)));
88
+ export const notice = (message, properties) => runner.pipe(Effect.flatMap((service) => service.notice(message, properties)));
89
+ export const startGroup = (name) => runner.pipe(Effect.flatMap((service) => service.startGroup(name)));
90
+ export const endGroup = runner.pipe(Effect.flatMap((service) => service.endGroup()));
91
+ export const group = (name, fn) => runner.pipe(Effect.flatMap((service) => service.group(name, fn)));
92
+ export const exportVariable = (name, value) => runner.pipe(Effect.flatMap((service) => service.exportVariable(name, value)));
93
+ export const addPath = (path) => runner.pipe(Effect.flatMap((service) => service.addPath(path)));
94
+ export const setSecret = (secret) => runner.pipe(Effect.flatMap((service) => service.setSecret(secret)));
95
+ export const saveState = (name, value) => runner.pipe(Effect.flatMap((service) => service.saveState(name, value)));
96
+ export const getState = (name) => runner.pipe(Effect.flatMap((service) => service.getState(name)));
97
+ export const setFailed = (message) => runner.pipe(Effect.flatMap((service) => service.setFailed(message)));
98
+ export const getIDToken = (audience) => runner.pipe(Effect.flatMap((service) => service.getIDToken(audience)));
99
+ export const { layer } = ActionRunner;
100
+ //# sourceMappingURL=action-runner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"action-runner.js","sourceRoot":"","sources":["../src/action-runner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM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