@effected/github-actions 0.34.0 → 0.36.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 (46) hide show
  1. package/Action.js +10 -10
  2. package/ActionCache.js +17 -40
  3. package/ActionEnvironment.js +1 -1
  4. package/ActionInput.js +1 -1
  5. package/ActionLogger.js +197 -64
  6. package/ActionManifest.js +2 -2
  7. package/ActionOutputs.js +2 -2
  8. package/ActionState.js +1 -1
  9. package/ActionsIdentityToken.js +2 -2
  10. package/ActionsProvenance.js +2 -2
  11. package/ActionsRegistryCredential.js +2 -2
  12. package/Artifact.js +16 -39
  13. package/BlobStore.githubCache.js +16 -42
  14. package/BlobStore.js +4 -4
  15. package/CacheKey.js +2 -2
  16. package/CheckDocument.js +1 -1
  17. package/Checkout.js +361 -0
  18. package/DetachedProcess.js +4 -4
  19. package/DryRun.js +1 -1
  20. package/GitHubMarkdown.js +1 -1
  21. package/GitHubToken.js +2 -2
  22. package/ManagedDocument.js +1 -1
  23. package/OidcTokenIssuer.js +7 -7
  24. package/PackageManagerInstaller.js +3 -3
  25. package/README.md +4 -3
  26. package/Secret.js +1 -1
  27. package/ToolInstaller.js +4 -4
  28. package/index.d.ts +602 -119
  29. package/index.js +3 -2
  30. package/internal/actionsResults.js +1 -1
  31. package/internal/blobCause.js +2 -80
  32. package/internal/blobTransport.js +172 -0
  33. package/internal/cacheService.js +1 -1
  34. package/internal/checkout/asciiTrim.js +18 -0
  35. package/internal/checkout/credentials.js +563 -0
  36. package/internal/checkout/directory.js +119 -0
  37. package/internal/checkout/inputs.js +130 -0
  38. package/internal/checkout/refs.js +143 -0
  39. package/internal/checkout/settings.js +144 -0
  40. package/internal/checkout/source.js +418 -0
  41. package/internal/checkout/unsafePullRequest.js +62 -0
  42. package/internal/digest.js +1 -1
  43. package/internal/pnpmExe.js +1 -1
  44. package/internal/stepLog.js +225 -0
  45. package/internal/twirp.js +1 -1
  46. package/package.json +6 -6
@@ -0,0 +1,130 @@
1
+ import { Config, Effect, Option, Redacted, Schema, SchemaIssue } from "effect";
2
+ import { ActionEnvironment } from "../../ActionEnvironment.js";
3
+ import { ActionInput } from "../../ActionInput.js";
4
+ import { ActionManifestInput } from "../../ActionManifest.js";
5
+ import { asciiTrim } from "./asciiTrim.js";
6
+
7
+ // src/internal/checkout/inputs.ts
8
+ const SHA_PATTERN = /^(?:[0-9a-fA-F]{40}|[0-9a-fA-F]{64})$/;
9
+ const invalid = (message, actual) => new Config.ConfigError(new Schema.SchemaError(new SchemaIssue.InvalidValue({ message }, actual)));
10
+ /**
11
+ * One checkout input: its name, checkout's description and its default.
12
+ *
13
+ * @internal
14
+ */
15
+ const declare = (description, defaultValue) => ActionManifestInput.make({
16
+ description,
17
+ ...defaultValue === void 0 ? {} : { default: defaultValue }
18
+ });
19
+ /** @internal */
20
+ const declarations = [
21
+ ["repository", declare("Repository name with owner. For example, actions/checkout", "${{ github.repository }}")],
22
+ ["ref", declare("The branch, tag or SHA to checkout. When checking out the repository that triggered a workflow, this defaults to the reference or SHA for that event. Otherwise, uses the default branch.\n")],
23
+ ["token", declare("Personal access token (PAT) used to fetch the repository. The PAT is configured with the local git config, which enables your scripts to run authenticated git commands. The post-job step removes the PAT.\nWe recommend using a service account with the least permissions necessary. Also when generating a new PAT, select the least scopes necessary.\n[Learn more about creating and using encrypted secrets](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/creating-and-using-encrypted-secrets)\n", "${{ github.token }}")],
24
+ ["ssh-key", declare("SSH key used to fetch the repository. The SSH key is configured with the local git config, which enables your scripts to run authenticated git commands. The post-job step removes the SSH key.\nWe recommend using a service account with the least permissions necessary.\n[Learn more about creating and using encrypted secrets](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/creating-and-using-encrypted-secrets)\n")],
25
+ ["ssh-known-hosts", declare("Known hosts in addition to the user and global host key database. The public SSH keys for a host may be obtained using the utility `ssh-keyscan`. For example, `ssh-keyscan github.com`. The public key for github.com is always implicitly added.\n")],
26
+ ["ssh-strict", declare("Whether to perform strict host key checking. When true, adds the options `StrictHostKeyChecking=yes` and `CheckHostIP=no` to the SSH command line. Use the input `ssh-known-hosts` to configure additional hosts.\n", "true")],
27
+ ["ssh-user", declare("The user to use when connecting to the remote SSH host. By default 'git' is used.\n", "git")],
28
+ ["persist-credentials", declare("Whether to configure the token or SSH key with the local git config", "true")],
29
+ ["path", declare("Relative path under $GITHUB_WORKSPACE to place the repository")],
30
+ ["clean", declare("Whether to execute `git clean -ffdx && git reset --hard HEAD` before fetching", "true")],
31
+ ["filter", declare("Partially clone against a given filter. Overrides sparse-checkout if set.\n")],
32
+ ["sparse-checkout", declare("Do a sparse checkout on given patterns. Each pattern should be separated with new lines.\n")],
33
+ ["sparse-checkout-cone-mode", declare("Specifies whether to use cone-mode when doing a sparse checkout.\n", "true")],
34
+ ["fetch-depth", declare("Number of commits to fetch. 0 indicates all history for all branches and tags.", "1")],
35
+ ["fetch-tags", declare("Whether to fetch tags, even if fetch-depth > 0.", "false")],
36
+ ["show-progress", declare("Whether to show progress status output when fetching.", "true")],
37
+ ["lfs", declare("Whether to download Git-LFS files", "false")],
38
+ ["submodules", declare("Whether to checkout submodules: `true` to checkout submodules or `recursive` to recursively checkout submodules.\nWhen the `ssh-key` input is not provided, SSH URLs beginning with `git@github.com:` are converted to HTTPS.\n", "false")],
39
+ ["set-safe-directory", declare("Add repository path as safe.directory for Git global config by running `git config --global --add safe.directory <path>`", "true")],
40
+ ["github-server-url", declare("The base URL for the GitHub instance that you are trying to clone from, will use environment defaults to fetch from the same instance that the workflow is running from unless specified. Example URLs are https://github.com or https://my-ghes-server.example.com")],
41
+ ["allow-unsafe-pr-checkout", declare("Required to check out fork pull request code from a workflow triggered by `pull_request_target` or `workflow_run`. These workflows run with the base repository's GITHUB_TOKEN, secrets, default-branch cache scope, and runner access; fetching and executing a fork's code in that trusted context commonly leads to \"pwn request\" vulnerabilities. Set to `true` only after reviewing the risks at https://gh.io/securely-using-pull_request_target.\n", "false")]
42
+ ];
43
+ const trimmed = (name) => Config.option(ActionInput.string(name)).pipe(Config.map((value) => Option.flatMap(value, (raw) => {
44
+ const text = raw.trim();
45
+ return text === "" ? Option.none() : Option.some(text);
46
+ })));
47
+ const flag = (name, codeDefault) => Config.map(trimmed(name), (value) => Option.match(value, {
48
+ onNone: () => codeDefault,
49
+ onSome: (text) => text.toUpperCase() === "TRUE"
50
+ }));
51
+ const optional = trimmed;
52
+ const optionalSecret = (name) => Config.map(trimmed(name), Option.map((text) => Redacted.make(text)));
53
+ const withFallback = (name, fallback) => Config.map(trimmed(name), Option.getOrElse(() => fallback));
54
+ /** @internal */
55
+ const readInputs = (prefix) => Effect.gen(function* () {
56
+ const github = yield* (yield* ActionEnvironment).github;
57
+ const n = (name) => `${prefix}${name}`;
58
+ const qualified = yield* withFallback(n("repository"), github.repository);
59
+ const parts = qualified.split("/");
60
+ if (parts.length !== 2 || !parts[0] || !parts[1]) return yield* Effect.fail(invalid(`Invalid repository '${qualified}'. Expected format {owner}/{repo}.`, qualified));
61
+ const isWorkflowRepository = qualified.toUpperCase() === github.repository.toUpperCase();
62
+ const rawRef = asciiTrim(Option.getOrElse(yield* Config.option(ActionInput.string(n("ref"))), () => ""));
63
+ const ref = rawRef === "" ? isWorkflowRepository ? { _tag: "Event" } : { _tag: "Default" } : SHA_PATTERN.test(rawRef) ? {
64
+ _tag: "Commit",
65
+ sha: rawRef
66
+ } : {
67
+ _tag: "Ref",
68
+ ref: rawRef
69
+ };
70
+ const tokenInput = yield* optionalSecret(n("token"));
71
+ if (Option.isNone(tokenInput)) return yield* Effect.fail(invalid(`Input "${n("token")}" is required`, ""));
72
+ const token = tokenInput.value;
73
+ const sshKey = yield* optionalSecret(n("ssh-key"));
74
+ const auth = Option.isSome(sshKey) ? {
75
+ _tag: "Ssh",
76
+ key: sshKey.value,
77
+ token,
78
+ strict: yield* flag(n("ssh-strict"), true),
79
+ user: yield* withFallback(n("ssh-user"), "git"),
80
+ ...Option.match(yield* optional(n("ssh-known-hosts")), {
81
+ onNone: () => ({}),
82
+ onSome: (knownHosts) => ({ knownHosts })
83
+ })
84
+ } : {
85
+ _tag: "Token",
86
+ token
87
+ };
88
+ const persist = yield* flag(n("persist-credentials"), false);
89
+ const path = yield* optional(n("path"));
90
+ const clean = yield* flag(n("clean"), true);
91
+ const filter = yield* optional(n("filter"));
92
+ const patterns = yield* ActionInput.lines(n("sparse-checkout")).pipe(Config.withDefault([]));
93
+ const cone = yield* flag(n("sparse-checkout-cone-mode"), true);
94
+ const rawDepth = yield* withFallback(n("fetch-depth"), "1");
95
+ const depthNumber = Math.floor(Number(rawDepth));
96
+ const depth = Number.isNaN(depthNumber) || depthNumber <= 0 ? "full" : depthNumber;
97
+ const fetchTags = yield* flag(n("fetch-tags"), false);
98
+ yield* optional(n("show-progress"));
99
+ const lfs = yield* flag(n("lfs"), false);
100
+ const submodulesText = (yield* withFallback(n("submodules"), "")).toUpperCase();
101
+ const submodules = submodulesText === "RECURSIVE" ? "recursive" : submodulesText === "TRUE";
102
+ const safeDirectory = yield* flag(n("set-safe-directory"), true);
103
+ const serverUrl = yield* optional(n("github-server-url"));
104
+ const allowUnsafePrCheckout = yield* flag(n("allow-unsafe-pr-checkout"), false);
105
+ return {
106
+ repository: {
107
+ owner: parts[0],
108
+ name: parts[1]
109
+ },
110
+ ref,
111
+ auth,
112
+ credentials: persist ? "job" : "none",
113
+ clean,
114
+ depth,
115
+ fetchTags,
116
+ lfs,
117
+ submodules,
118
+ safeDirectory,
119
+ allowUnsafePrCheckout,
120
+ ...Option.isSome(path) ? { path: path.value } : {},
121
+ ...Option.isSome(filter) ? { filter: filter.value } : {},
122
+ ...patterns.length > 0 ? { sparse: {
123
+ patterns,
124
+ cone
125
+ } } : {},
126
+ ...Option.isSome(serverUrl) ? { serverUrl: serverUrl.value } : {}
127
+ };
128
+ });
129
+
130
+ export { declarations, readInputs };
@@ -0,0 +1,143 @@
1
+ import { Effect, Option } from "effect";
2
+ import { CheckoutRefNotFoundError } from "../../Checkout.js";
3
+
4
+ // src/internal/checkout/refs.ts
5
+ const TAGS_REF_SPEC = "+refs/tags/*:refs/tags/*";
6
+ const bothEmpty = () => {
7
+ throw new Error("Args ref and commit cannot both be empty");
8
+ };
9
+ /**
10
+ * Every refspec for fetching all history, as `getRefSpecForAllHistory` does.
11
+ *
12
+ * @internal
13
+ */
14
+ const refSpecForAllHistory = (ref, commit) => {
15
+ const result = ["+refs/heads/*:refs/remotes/origin/*", TAGS_REF_SPEC];
16
+ if (ref && ref.toUpperCase().startsWith("REFS/PULL/")) {
17
+ const branch = ref.substring(10);
18
+ result.push(`+${commit || ref}:refs/remotes/pull/${branch}`);
19
+ }
20
+ return result;
21
+ };
22
+ /**
23
+ * The refspecs of the initial fetch, as `getRefSpec` does. Throws when `ref` and
24
+ * `commit` are both empty, a programming error.
25
+ *
26
+ * @internal
27
+ */
28
+ const refSpec = (ref, commit, fetchTags) => {
29
+ if (!ref && !commit) return bothEmpty();
30
+ const upperRef = (ref || "").toUpperCase();
31
+ const result = [];
32
+ if (fetchTags) result.push(TAGS_REF_SPEC);
33
+ if (commit) {
34
+ if (upperRef.startsWith("REFS/HEADS/")) {
35
+ const branch = ref.substring(11);
36
+ result.push(`+${commit}:refs/remotes/origin/${branch}`);
37
+ } else if (upperRef.startsWith("REFS/PULL/")) {
38
+ const branch = ref.substring(10);
39
+ result.push(`+${commit}:refs/remotes/pull/${branch}`);
40
+ } else if (upperRef.startsWith("REFS/TAGS/")) {
41
+ if (!fetchTags) result.push(`+${ref}:${ref}`);
42
+ } else result.push(commit);
43
+ } else if (!upperRef.startsWith("REFS/")) {
44
+ result.push(`+refs/heads/${ref}*:refs/remotes/origin/${ref}*`);
45
+ if (!fetchTags) result.push(`+refs/tags/${ref}*:refs/tags/${ref}*`);
46
+ } else if (upperRef.startsWith("REFS/HEADS/")) {
47
+ const branch = ref.substring(11);
48
+ result.push(`+${ref}:refs/remotes/origin/${branch}`);
49
+ } else if (upperRef.startsWith("REFS/PULL/")) {
50
+ const branch = ref.substring(10);
51
+ result.push(`+${ref}:refs/remotes/pull/${branch}`);
52
+ } else if (upperRef.startsWith("REFS/TAGS/")) {
53
+ if (!fetchTags) result.push(`+${ref}:${ref}`);
54
+ } else result.push(`+${ref}:${ref}`);
55
+ return result;
56
+ };
57
+ /**
58
+ * Where the working tree is checked out to, as `getCheckoutInfo` does.
59
+ *
60
+ * @remarks
61
+ * `ref` and `commit` both empty is a programming error and dies, as checkout's
62
+ * throw does.
63
+ *
64
+ * @internal
65
+ */
66
+ const checkoutInfo = (lookup, ref, commit) => Effect.gen(function* () {
67
+ if (!ref && !commit) return yield* Effect.die(/* @__PURE__ */ new Error("Args ref and commit cannot both be empty"));
68
+ const upperRef = (ref || "").toUpperCase();
69
+ if (!ref) return {
70
+ ref: commit,
71
+ startPoint: Option.none()
72
+ };
73
+ if (upperRef.startsWith("REFS/HEADS/")) {
74
+ const branch = ref.substring(11);
75
+ return {
76
+ ref: branch,
77
+ startPoint: Option.some(`refs/remotes/origin/${branch}`)
78
+ };
79
+ }
80
+ if (upperRef.startsWith("REFS/PULL/")) return {
81
+ ref: `refs/remotes/pull/${ref.substring(10)}`,
82
+ startPoint: Option.none()
83
+ };
84
+ if (upperRef.startsWith("REFS/TAGS/")) return {
85
+ ref,
86
+ startPoint: Option.none()
87
+ };
88
+ if (upperRef.startsWith("REFS/")) return {
89
+ ref: commit ? commit : ref,
90
+ startPoint: Option.none()
91
+ };
92
+ if (yield* lookup.branchExists(`origin/${ref}`)) return {
93
+ ref,
94
+ startPoint: Option.some(`refs/remotes/origin/${ref}`)
95
+ };
96
+ if (yield* lookup.tagExists(ref)) return {
97
+ ref: `refs/tags/${ref}`,
98
+ startPoint: Option.none()
99
+ };
100
+ return yield* new CheckoutRefNotFoundError({ ref });
101
+ });
102
+ /**
103
+ * Tests whether the initial fetch created the ref at the expected commit, as
104
+ * `testRef` does.
105
+ *
106
+ * @internal
107
+ */
108
+ const testRef = (lookup, ref, commit) => Effect.gen(function* () {
109
+ if (!ref && !commit) return yield* Effect.die(/* @__PURE__ */ new Error("Args ref and commit cannot both be empty"));
110
+ if (!commit) return true;
111
+ if (!ref) return yield* lookup.shaExists(commit);
112
+ const upperRef = ref.toUpperCase();
113
+ if (upperRef.startsWith("REFS/HEADS/")) {
114
+ const branch = ref.substring(11);
115
+ return (yield* lookup.branchExists(`origin/${branch}`)) && commit === (yield* lookup.revParse(`refs/remotes/origin/${branch}`));
116
+ }
117
+ if (upperRef.startsWith("REFS/PULL/")) return true;
118
+ if (upperRef.startsWith("REFS/TAGS/")) {
119
+ const tagName = ref.substring(10);
120
+ return (yield* lookup.tagExists(tagName)) && commit === (yield* lookup.revParse(`${ref}^{commit}`));
121
+ }
122
+ return true;
123
+ });
124
+ /**
125
+ * The `SCHEME://HOST[:PORT]` of a server URL.
126
+ *
127
+ * @internal
128
+ */
129
+ const serverOrigin = (serverUrl) => new URL(serverUrl).origin;
130
+ /**
131
+ * The remote URL a checkout fetches from, as `getFetchUrl` builds it.
132
+ *
133
+ * @internal
134
+ */
135
+ const fetchUrl = (settings) => {
136
+ const service = new URL(settings.serverUrl);
137
+ const owner = encodeURIComponent(settings.owner);
138
+ const name = encodeURIComponent(settings.name);
139
+ if (settings.auth._tag === "Ssh") return `${settings.auth.user !== void 0 && settings.auth.user.length > 0 ? settings.auth.user : "git"}@${service.hostname}:${owner}/${name}.git`;
140
+ return `${service.origin}/${owner}/${name}`;
141
+ };
142
+
143
+ export { checkoutInfo, fetchUrl, refSpec, refSpecForAllHistory, serverOrigin, testRef };
@@ -0,0 +1,144 @@
1
+ import { Effect, Option, Path } from "effect";
2
+ import { CheckoutPathError, CheckoutServerUrlError, CheckoutUnqualifiedRefPinError } from "../../Checkout.js";
3
+ import { asciiTrim } from "./asciiTrim.js";
4
+ import { assertSafePullRequest } from "./unsafePullRequest.js";
5
+
6
+ // src/internal/checkout/settings.ts
7
+ const DEFAULT_SERVER_URL = "https://github.com";
8
+ /**
9
+ * Why a server URL is refused, or none when it is an absolute `http` or `https` URL naming a host. Everything later
10
+ * hands it to `URL`, so a refusal here is the only failure it can produce.
11
+ */
12
+ const serverUrlProblem = (serverUrl) => {
13
+ const trimmed = serverUrl.trim();
14
+ if (!/^[A-Za-z][A-Za-z0-9+.-]*:\/\//.test(trimmed)) {
15
+ const example = /^[A-Za-z0-9.-]+(?::\d+)?(?:\/\S*)?$/.test(trimmed) ? trimmed : "ghe.example.com";
16
+ return Option.some(`it has no scheme; include it, as in "https://${example}"`);
17
+ }
18
+ if (!URL.canParse(serverUrl)) return Option.some("it is not a valid URL");
19
+ const url = new URL(serverUrl);
20
+ if (url.protocol !== "https:" && url.protocol !== "http:") return Option.some(`its scheme must be http or https, not ${url.protocol.slice(0, -1)}`);
21
+ if (url.hostname === "") return Option.some("it names no host");
22
+ return Option.none();
23
+ };
24
+ const SHA_PATTERN = /^(?:[0-9a-fA-F]{40}|[0-9a-fA-F]{64})$/;
25
+ const lowerRef = (ref, context) => {
26
+ switch (ref._tag) {
27
+ case "Event": {
28
+ const commit = context.sha;
29
+ return {
30
+ ref: commit && context.ref && !context.ref.startsWith("refs/") ? `refs/heads/${context.ref}` : context.ref,
31
+ commit
32
+ };
33
+ }
34
+ case "Default": return {
35
+ ref: "",
36
+ commit: ""
37
+ };
38
+ case "Branch": return {
39
+ ref: `refs/heads/${ref.name}`,
40
+ commit: ref.commit ?? ""
41
+ };
42
+ case "Tag": return {
43
+ ref: `refs/tags/${ref.name}`,
44
+ commit: ref.commit ?? ""
45
+ };
46
+ case "Commit": return {
47
+ ref: "",
48
+ commit: ref.sha
49
+ };
50
+ case "PullRequest": return {
51
+ ref: `refs/pull/${ref.number}/${ref.kind}`,
52
+ commit: ref.commit ?? ""
53
+ };
54
+ case "Ref": {
55
+ const trimmed = asciiTrim(ref.ref);
56
+ if (SHA_PATTERN.test(trimmed)) return {
57
+ ref: "",
58
+ commit: trimmed
59
+ };
60
+ return {
61
+ ref: ref.ref,
62
+ commit: ref.commit ?? ""
63
+ };
64
+ }
65
+ }
66
+ };
67
+ /**
68
+ * Resolves {@link CheckoutOptions} into {@link Settings}, as checkout's
69
+ * `getInputs` does.
70
+ *
71
+ * @remarks
72
+ * Pure: the workflow's context, workspace and event payload come in as
73
+ * arguments. Fails when the path leaves the workspace, when the server URL is
74
+ * not an absolute `http` or `https` URL, or when a privileged event would check
75
+ * out fork pull request code. The guard is skipped only for
76
+ * the default self-checkout: the workflow's own repository at `Event`.
77
+ *
78
+ * @internal
79
+ */
80
+ const lower = (options, context) => Effect.gen(function* () {
81
+ const path = yield* Path.Path;
82
+ const workspace = path.resolve(context.workspace);
83
+ const owner = options.repository?.owner ?? context.github.repositoryOwner;
84
+ const name = options.repository?.name ?? context.github.repository.slice(context.github.repository.indexOf("/") + 1);
85
+ const qualified = `${owner}/${name}`;
86
+ const repositoryPath = path.resolve(workspace, options.path ?? ".");
87
+ if (!(repositoryPath + path.sep).startsWith(workspace + path.sep)) return yield* new CheckoutPathError({
88
+ path: options.path ?? ".",
89
+ workspace
90
+ });
91
+ const serverUrl = options.serverUrl || context.github.serverUrl || DEFAULT_SERVER_URL;
92
+ const serverUrlRefused = serverUrlProblem(serverUrl);
93
+ if (Option.isSome(serverUrlRefused)) return yield* new CheckoutServerUrlError({
94
+ serverUrl,
95
+ detail: serverUrlRefused.value
96
+ });
97
+ const isWorkflowRepository = qualified.toUpperCase() === context.github.repository.toUpperCase();
98
+ const refOption = options.ref ?? (isWorkflowRepository ? { _tag: "Event" } : { _tag: "Default" });
99
+ if (refOption._tag === "Ref" && refOption.commit !== void 0 && !refOption.ref.startsWith("refs/")) return yield* new CheckoutUnqualifiedRefPinError({ ref: refOption.ref });
100
+ const lowered = lowerRef(refOption, context.github);
101
+ const ref = lowered.ref;
102
+ const commit = lowered.commit.toLowerCase();
103
+ const allowUnsafePrCheckout = options.allowUnsafePrCheckout ?? false;
104
+ if (!(isWorkflowRepository && refOption._tag === "Event")) yield* assertSafePullRequest({
105
+ repository: qualified,
106
+ ref,
107
+ commit,
108
+ allowUnsafe: allowUnsafePrCheckout
109
+ }, {
110
+ name: context.github.eventName,
111
+ payload: context.payload
112
+ });
113
+ const rawDepth = options.depth ?? 1;
114
+ const depth = rawDepth === "full" ? 0 : Math.floor(rawDepth);
115
+ const submodules = options.submodules ?? false;
116
+ return {
117
+ owner,
118
+ name,
119
+ path: repositoryPath,
120
+ ref,
121
+ commit,
122
+ isWorkflowRepository,
123
+ clean: options.clean ?? true,
124
+ depth: Number.isNaN(depth) || depth < 0 ? 0 : depth,
125
+ fetchTags: options.fetchTags ?? false,
126
+ filter: Option.fromNullishOr(options.filter),
127
+ sparse: Option.map(Option.fromNullishOr(options.sparse), (s) => ({
128
+ patterns: s.patterns,
129
+ cone: s.cone ?? true
130
+ })),
131
+ lfs: options.lfs ?? false,
132
+ submodules: submodules !== false,
133
+ nestedSubmodules: submodules === "recursive",
134
+ auth: options.auth,
135
+ credentials: options.credentials ?? "job",
136
+ safeDirectory: options.safeDirectory ?? true,
137
+ serverUrl,
138
+ remoteUrl: Option.fromNullishOr(options.remoteUrl),
139
+ allowUnsafePrCheckout,
140
+ stateKey: options.stateKey ?? "effected-checkout"
141
+ };
142
+ });
143
+
144
+ export { lower };