Skip to content
This repository has been archived by the owner on Jul 9, 2024. It is now read-only.

Commit

Permalink
fix: git ownership issue (#72)
Browse files Browse the repository at this point in the history
  • Loading branch information
ronnetzer authored Jun 1, 2023
1 parent 79c90c7 commit 7bb8e09
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 35 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,9 @@ jobs:
with:
token: ${{ secrets.GH_AUTH_SECRET }}

- name: Fix git permissions
run: git config --global --add safe.directory "*"

- name: Publish action ${{ matrix.package }}
if: ${{ contains(needs.setup.outputs.matrix, matrix.package) }}
uses: e-square-io/.github/.github/actions/push-to-repo@main
Expand Down
70 changes: 35 additions & 35 deletions packages/utils/src/lib/inputs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,41 @@ export function getStringArrayInput(
.map((value) => value.trim());
}

export function getBaseInputs(
core: typeof Core,
mode: Parameters<typeof splitArgsIntoNxArgsAndOverrides>[1]
): BaseInputs {
const debug = core.getBooleanInput('debug');
const workingDirectory = core.getInput('workingDirectory');

logger(core).debugMode = debug;

if (workingDirectory?.length > 0) {
log(`🏃 Working in custom directory: ${workingDirectory}`);
process.env.NX_WORKSPACE_ROOT_PATH = workingDirectory;
process.chdir(workingDirectory);
}

return {
args: getArgsInput(core, mode),
debug,
workingDirectory,
};
}

export function getArgsInput(
core: typeof Core,
mode: Parameters<typeof splitArgsIntoNxArgsAndOverrides>[1] = 'print-affected',
options?: Core.InputOptions
): NxArgs {
const args = getStringArrayInput(core, 'args', /[= ]/g, options);
const { nxArgs, overrides } = splitArgsIntoNxArgsAndOverrides({ _: args, $0: '' }, mode, {
printWarnings: false,
}) ?? { nxArgs: {}, overrides: {} };

return parseNxArgs({ ...nxArgs, ...overrides });
}

export function parseNxArgs(args: Record<string, unknown>): NxArgs {
const aliasArgs: Record<string, keyof NxArgs> = { c: 'configuration' };
const arrArgs: (keyof NxArgs)[] = ['exclude', 'projects', 'files'];
Expand Down Expand Up @@ -64,19 +99,6 @@ export function shouldRunWithDeps(target: string): boolean {
}
}

export function getArgsInput(
core: typeof Core,
mode: Parameters<typeof splitArgsIntoNxArgsAndOverrides>[1] = 'print-affected',
options?: Core.InputOptions
): NxArgs {
const args = getStringArrayInput(core, 'args', /[= ]/g, options);
const { nxArgs, overrides } = splitArgsIntoNxArgsAndOverrides({ _: args, $0: '' }, mode, {
printWarnings: false,
}) ?? { nxArgs: {}, overrides: {} };

return parseNxArgs({ ...nxArgs, ...overrides });
}

export function getMaxDistribution(
core: typeof Core,
targets: string | string[],
Expand Down Expand Up @@ -112,25 +134,3 @@ export function getMaxDistribution(

return reduceTargetsDistribution(maybeNumberValue);
}

export function getBaseInputs(
core: typeof Core,
mode: Parameters<typeof splitArgsIntoNxArgsAndOverrides>[1]
): BaseInputs {
const debug = core.getBooleanInput('debug');
const workingDirectory = core.getInput('workingDirectory');

logger(core).debugMode = debug;

if (workingDirectory?.length > 0) {
log(`🏃 Working in custom directory: ${workingDirectory}`);
process.env.NX_WORKSPACE_ROOT_PATH = workingDirectory;
process.chdir(workingDirectory);
}

return {
args: getArgsInput(core, mode),
debug,
workingDirectory,
};
}

0 comments on commit 7bb8e09

Please sign in to comment.