Visitar URL original
Use private registry proxy for API requests when available by mbg · Pull Request #4007 · github/codeql-action · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add and use clone method for ReadOnlyEnv
  • Loading branch information
mbg committed Jul 14, 2026
commit b946565527528c534f210541ae538484e228a3ce
4 changes: 4 additions & 0 deletions lib/entry-points.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,11 @@ export function getOptionalEnvVar(paramName: string): string | undefined {
export class ReadOnlyEnv<T extends string | undefined = string | undefined> {
constructor(protected readonly vars: Record<string, T>) {}

/** Clones the object while detaching the underlying environment from the original. */
public clone(): this {
return Object.create(this, { vars: { value: { ...this.vars } } }) as this;
}

/** Tries to get the value for `name` and throws if there isn't one. */
public getRequired(name: string): string {
return getRequiredEnvVar(this.vars, name);
Expand Down
2 changes: 1 addition & 1 deletion src/testing-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ abstract class BaseEnvBuilder<
cloneFrom !== undefined
? ({
...cloneFrom.state,
env: Object.create(cloneFrom.state.env),
env: cloneFrom.state.env.clone(),
actions: Object.create(cloneFrom.state.actions),
logger: this.logger,
} satisfies ActionState<AllState>)
Expand Down