Skip to content

Conversation

@leeyi45
Copy link
Contributor

@leeyi45 leeyi45 commented Nov 10, 2025

@RichDom2185 provided some code that would help detect which workspaces need to be rebuilt based on diffs across lockfiles. This PR will implement that change, as well as fix some typos in the documentation.

// Not using the repotools version since this uses @action/exec instead of
// calling execFile from child_process
export async function getGitRoot() {
const { stdout } = await getExecOutput('git rev-parse --show-toplevel');
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: getExecOutput is called with the full command string as the executable, instead of separating the command and its arguments.
Severity: CRITICAL | Confidence: 1.00

🔍 Detailed Analysis

The getExecOutput function is called with the entire command git rev-parse --show-toplevel as a single string for the command parameter. The @actions/exec API expects the executable and its arguments to be separate parameters. This will cause the shell to attempt to execute a non-existent command named "git rev-parse --show-toplevel", leading to a failure in the GitHub Actions workflow.

💡 Suggested Fix

Pass 'git' as the first argument and ['rev-parse', '--show-toplevel'] as the second argument to getExecOutput.

🤖 Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: .github/actions/src/gitRoot.ts#L6

Potential issue: The `getExecOutput` function is called with the entire command `git
rev-parse --show-toplevel` as a single string for the `command` parameter. The
`@actions/exec` API expects the executable and its arguments to be separate parameters.
This will cause the shell to attempt to execute a non-existent command named `"git
rev-parse --show-toplevel"`, leading to a failure in the GitHub Actions workflow.

Did we get this right? 👍 / 👎 to inform future reviews.

Comment on lines +145 to +152
const { exitCode } = await getExecOutput(
'git --no-pager diff --quiet origin/master -- yarn.lock',
[],
{
failOnStdErr: false,
ignoreReturnCode: true
}
);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: getExecOutput is called with the full command string as the executable, instead of separating the command and its arguments.
Severity: CRITICAL | Confidence: 1.00

🔍 Detailed Analysis

The getExecOutput function is called with the entire command git --no-pager diff --quiet origin/master -- yarn.lock as a single string for the command parameter. The @actions/exec API expects the executable and its arguments to be separate parameters. This will cause the shell to attempt to execute a non-existent command named "git --no-pager diff --quiet origin/master -- yarn.lock", leading to a failure when checking lockfile changes.

💡 Suggested Fix

Pass 'git' as the first argument and ['--no-pager', 'diff', '--quiet', 'origin/master', '--', 'yarn.lock'] as the second argument to getExecOutput.

🤖 Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: .github/actions/src/lockfiles.ts#L145-L152

Potential issue: The `getExecOutput` function is called with the entire command `git
--no-pager diff --quiet origin/master -- yarn.lock` as a single string for the `command`
parameter. The `@actions/exec` API expects the executable and its arguments to be
separate parameters. This will cause the shell to attempt to execute a non-existent
command named `"git --no-pager diff --quiet origin/master -- yarn.lock"`, leading to a
failure when checking lockfile changes.

Did we get this right? 👍 / 👎 to inform future reviews.

});
// focus all at once
const workspaces = tabsToBuild.map(each => `@sourceacademy/tab-${each}`);
const focusExitCode = await exec('yarn workspaces focus', workspaces, { silent: false });
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: exec is called with the full command string as the executable, instead of separating the command and its arguments.
Severity: CRITICAL | Confidence: 1.00

🔍 Detailed Analysis

The exec function is called with the entire command yarn workspaces focus as a single string for the executable parameter. The @actions/exec API expects the executable and its arguments to be separate parameters. This will cause the shell to attempt to execute a non-existent command named "yarn workspaces focus", leading to a failure in the workspace focus command.

💡 Suggested Fix

Pass 'yarn' as the first argument and ['workspaces', 'focus', ...workspaces] as the second argument to exec.

🤖 Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: .github/actions/src/load-artifacts/index.ts#L43

Potential issue: The `exec` function is called with the entire command `yarn workspaces
focus` as a single string for the `executable` parameter. The `@actions/exec` API
expects the executable and its arguments to be separate parameters. This will cause the
shell to attempt to execute a non-existent command named `"yarn workspaces focus"`,
leading to a failure in the workspace focus command.

Did we get this right? 👍 / 👎 to inform future reviews.

Comment on lines 50 to 52
const buildExitCode = await exec(
'yarn workspaces foreach -pA',
[...workspaceBuildArgs, 'run', 'build'],
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: exec is called with the full command string as the executable, instead of separating the command and its arguments.
Severity: CRITICAL | Confidence: 1.00

🔍 Detailed Analysis

The exec function is called with the entire command yarn workspaces foreach -pA as a single string for the executable parameter. The @actions/exec API expects the executable and its arguments to be separate parameters. This will cause the shell to attempt to execute a non-existent command named "yarn workspaces foreach -pA", leading to a failure in the build command.

💡 Suggested Fix

Pass 'yarn' as the first argument and ['workspaces', 'foreach', '-pA', ...workspaceBuildArgs, 'run', 'build'] as the second argument to exec.

🤖 Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: .github/actions/src/load-artifacts/index.ts#L50-L52

Potential issue: The `exec` function is called with the entire command `yarn workspaces
foreach -pA` as a single string for the `executable` parameter. The `@actions/exec` API
expects the executable and its arguments to be separate parameters. This will cause the
shell to attempt to execute a non-existent command named `"yarn workspaces foreach
-pA"`, leading to a failure in the build command.

Did we get this right? 👍 / 👎 to inform future reviews.

…es-fix

# Conflicts:
#	.github/actions/src/gitRoot.ts
#	.github/actions/src/info/__tests__/index.test.ts
#	.github/actions/src/info/index.ts
@leeyi45
Copy link
Contributor Author

leeyi45 commented Nov 10, 2025

Also no need to merge just yet, there are probably other things I need to add

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants