@effected/github-actions 0.18.1 → 0.19.1

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.
package/Action.js CHANGED
@@ -5,7 +5,7 @@ import { ActionLogger } from "./ActionLogger.js";
5
5
  import { ActionOutputs } from "./ActionOutputs.js";
6
6
  import { ActionState } from "./ActionState.js";
7
7
  import { NodeServices } from "@effect/platform-node";
8
- import { Cause, Effect, Exit, Layer, Option, Result } from "effect";
8
+ import { Cause, Effect, Exit, Layer, LogLevel, Option, References, Result } from "effect";
9
9
  import { FetchHttpClient } from "effect/http";
10
10
 
11
11
  //#region src/Action.ts
@@ -40,6 +40,15 @@ var ActionRuntime = class {
40
40
  static layer = Layer.mergeAll(ActionLogger.layer, ActionLogger.layerLogger, ActionState.layer, ActionInput.layerDefault).pipe(Layer.provideMerge(ActionOutputs.layer), Layer.provideMerge(ActionEnvironment.layer), Layer.provideMerge(Layer.mergeAll(NodeServices.layer, FetchHttpClient.layer)));
41
41
  };
42
42
  /**
43
+ * Lower the minimum log level to `Debug` for the program when the runner has
44
+ * step debugging on — and never raise it.
45
+ */
46
+ const withStepDebugLogLevel = (program) => Effect.gen(function* () {
47
+ const stepDebug = yield* (yield* ActionEnvironment).isDebug;
48
+ const minimum = yield* References.MinimumLogLevel;
49
+ return yield* stepDebug && LogLevel.isGreaterThan(minimum, "Debug") ? Effect.provideService(program, References.MinimumLogLevel, "Debug") : program;
50
+ });
51
+ /**
43
52
  * A readable one-line summary of why an action failed.
44
53
  *
45
54
  * @remarks
@@ -80,6 +89,14 @@ const describeError = (error) => {
80
89
  * reports a failure and then recovers is not doomed by a side effect it cannot
81
90
  * undo.
82
91
  *
92
+ * It also honours **step debugging**: when the runner sets `RUNNER_DEBUG=1`, it
93
+ * lowers core's `References.MinimumLogLevel` from its `Info` default to
94
+ * `Debug`, so `Effect.logDebug` anywhere in the program — or in any
95
+ * `@effected` library it calls — reaches the runner as a `::debug::` line
96
+ * rather than being filtered before a logger sees it. It only ever lowers the
97
+ * level, and `{ stepDebugLogLevel: false }` ({@link ActionRunOptions}) opts
98
+ * out.
99
+ *
83
100
  * Two things it deliberately does **not** do:
84
101
  *
85
102
  * - **It does not wrap the program in a log buffer.** The package this replaces
@@ -122,7 +139,7 @@ var Action = class {
122
139
  static run = (program, options = {}) => {
123
140
  const extra = options.layer;
124
141
  const composed = extra === void 0 ? ActionRuntime.layer : Layer.mergeAll(ActionRuntime.layer, Layer.provide(extra, ActionRuntime.layer));
125
- const runnable = program.pipe(Effect.provide(composed), Effect.exit, Effect.flatMap((exit) => Exit.isSuccess(exit) ? Effect.void : Effect.sync(() => {
142
+ const runnable = (options.stepDebugLogLevel === false ? program : withStepDebugLogLevel(program)).pipe(Effect.provide(composed), Effect.exit, Effect.flatMap((exit) => Exit.isSuccess(exit) ? Effect.void : Effect.sync(() => {
126
143
  const detail = Cause.pretty(exit.cause);
127
144
  if (detail.trim() !== "") console.log(WorkflowCommand.render("debug", {}, detail));
128
145
  console.log(WorkflowCommand.render("error", {}, `Action failed: ${describeCause(exit.cause)}`));
package/README.md CHANGED
@@ -59,6 +59,8 @@ await Action.run(program);
59
59
 
60
60
  `Action.run` provides `ActionServices` (environment, logger, outputs, state, the Node platform and an `HttpClient`) by default. A capability with a heavier dependency — the cache, artifacts, the blob store — is one extra line: `Action.run(program, { layer: ActionCache.layer })`.
61
61
 
62
+ Step debugging works without wiring: when the runner sets `RUNNER_DEBUG=1`, `Action.run` lowers Effect's minimum log level to `Debug`, so `Effect.logDebug` calls show up as `::debug::` lines. It only ever lowers the level; pass `{ stepDebugLogLevel: false }` to keep it as it is.
63
+
62
64
  ## Reading inputs
63
65
 
64
66
  Every accessor shares one absence rule: the runner writes `""` for an input the workflow omitted, and this package reads that the same as unset — **missing data**, not an empty value. An optional input needs `Config.withDefault` (or `Config.option`) at the call site:
package/index.d.ts CHANGED
@@ -378,7 +378,10 @@ interface ActionLoggerShape {
378
378
  * the ambient minimum log level is already `Debug` or lower — someone asking
379
379
  * for verbose output wants it live, and that overrides
380
380
  * `onSuccess: "discard"` too: asking for debug output means wanting to see
381
- * what a green step did.
381
+ * what a green step did. Under `Action.run` the two conditions coincide,
382
+ * because step debugging is what lowers the ambient level to `Debug`; the
383
+ * step-debug check still stands on its own for a program that opted out
384
+ * with `stepDebugLogLevel: false` or runs outside `Action.run`.
382
385
  */
383
386
  readonly withBuffer: <A, E, R>(label: string, effect: Effect.Effect<A, E, R>, options?: WithBufferOptions) => Effect.Effect<A, E, R>;
384
387
  /**
@@ -898,6 +901,24 @@ interface ActionRunOptions<R> {
898
901
  * what makes `{ layer: ActionCache.layer }` compile with no further wiring.
899
902
  */
900
903
  readonly layer?: Layer.Layer<R, never, ActionServices> | undefined;
904
+ /**
905
+ * Whether step debugging lowers the minimum log level to `Debug`.
906
+ *
907
+ * @remarks
908
+ * Defaults to `true`. With step debugging on (`RUNNER_DEBUG=1`, read through
909
+ * {@link ActionEnvironmentShape.isDebug}), `Action.run` lowers core's
910
+ * `References.MinimumLogLevel` — `Info` by default — to `Debug` for the whole
911
+ * program, so `Effect.logDebug` calls reach the runner as `::debug::` lines
912
+ * instead of being filtered before any logger sees them. It only ever
913
+ * **lowers**: a level already at `Debug` or below, from the `layer` option,
914
+ * is left alone.
915
+ *
916
+ * Pass `false` to keep the ambient level regardless of step debugging — an
917
+ * action whose debug output is too heavy to show even to someone who asked
918
+ * for it. A program can still provide its own `MinimumLogLevel` either way;
919
+ * the innermost provision wins.
920
+ */
921
+ readonly stepDebugLogLevel?: boolean | undefined;
901
922
  }
902
923
  /**
903
924
  * A readable one-line summary of why an action failed.
@@ -924,6 +945,14 @@ export declare const describeCause: (cause: Cause.Cause<unknown>) => string;
924
945
  * reports a failure and then recovers is not doomed by a side effect it cannot
925
946
  * undo.
926
947
  *
948
+ * It also honours **step debugging**: when the runner sets `RUNNER_DEBUG=1`, it
949
+ * lowers core's `References.MinimumLogLevel` from its `Info` default to
950
+ * `Debug`, so `Effect.logDebug` anywhere in the program — or in any
951
+ * `@effected` library it calls — reaches the runner as a `::debug::` line
952
+ * rather than being filtered before a logger sees it. It only ever lowers the
953
+ * level, and `{ stepDebugLogLevel: false }` ({@link ActionRunOptions}) opts
954
+ * out.
955
+ *
927
956
  * Two things it deliberately does **not** do:
928
957
  *
929
958
  * - **It does not wrap the program in a log buffer.** The package this replaces
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@effected/github-actions",
3
- "version": "0.18.1",
3
+ "version": "0.19.1",
4
4
  "private": false,
5
5
  "description": "The GitHub Actions runtime: env, inputs, outputs, state, logging, cache, artifacts, blob storage, OIDC and the token bridge.",
6
6
  "keywords": [
@@ -46,7 +46,7 @@
46
46
  "@effected/sbom": "^0.9.1",
47
47
  "@effected/semver": "^0.10.1",
48
48
  "@effected/templates": "^0.9.1",
49
- "@effected/walker": "^0.13.0"
49
+ "@effected/walker": "^0.14.0"
50
50
  },
51
51
  "peerDependencies": {
52
52
  "@effect/platform-node": "4.0.0-rc.118",