Skip to content
Open
Changes from all commits
Commits
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
34 changes: 34 additions & 0 deletions .github/workflows/precheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@ jobs:
- name: Decide which jobs to run
id: decide
uses: actions/github-script@v9
env:
# Dedicated token for the stack-decision commit status: this
# workflow's own token is scoped `checks: read` and cannot write
# statuses.
EVAL_STATUS_TOKEN: ${{ secrets.EVAL_STATUS_TOKEN }}
with:
script: |
const eventName = context.eventName;
Expand Down Expand Up @@ -344,3 +349,32 @@ jobs:
core.info(`Backport targets: ${targets.join(", ")}`);
}
core.setOutput("backport_targets", JSON.stringify(targets));

// Mirror the decision onto a commit status so reviewers can see
// which stacks a change selected without opening the run.
const statusToken = process.env.EVAL_STATUS_TOKEN || "";
if (statusToken) {
const selected = Object.entries({
frontend: runFrontend,
amber: runAmber,
platform: runPlatform,
pyamber: runPyamber,
"agent-service": runAgentService,
infra: runInfra,
})
.filter(([, on]) => on)
.map(([name]) => name)
.join(", ");
Comment on lines +357 to +367

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Include every selected stack in the status description.

The status map omits runAmberIntegration, runPlatformIntegration, and runPyrightLanguageService, although the decision code computes and exports these flags. A change that selects only one of these stacks publishes no stacks; a mixed selection hides those stacks.

Proposed fix
const selected = Object.entries({
  frontend: runFrontend,
  amber: runAmber,
+ "amber-integration": runAmberIntegration,
  platform: runPlatform,
+ "platform-integration": runPlatformIntegration,
  pyamber: runPyamber,
  "agent-service": runAgentService,
  infra: runInfra,
+ "pyright-language-service": runPyrightLanguageService,
})
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const selected = Object.entries({
frontend: runFrontend,
amber: runAmber,
platform: runPlatform,
pyamber: runPyamber,
"agent-service": runAgentService,
infra: runInfra,
})
.filter(([, on]) => on)
.map(([name]) => name)
.join(", ");
const selected = Object.entries({
frontend: runFrontend,
amber: runAmber,
"amber-integration": runAmberIntegration,
platform: runPlatform,
"platform-integration": runPlatformIntegration,
pyamber: runPyamber,
"agent-service": runAgentService,
infra: runInfra,
"pyright-language-service": runPyrightLanguageService,
})
.filter(([, on]) => on)
.map(([name]) => name)
.join(", ");
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/precheck.yml around lines 357 - 367, Update the status
stack map used to build selected in the workflow decision code to include
runAmberIntegration, runPlatformIntegration, and runPyrightLanguageService
alongside the existing flags, using the corresponding stack names so selections
of these flags appear in the published status description.

const { getOctokit } = require("@actions/github");
const status = getOctokit(statusToken);
Comment on lines +368 to +369

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

rg -n -C 3 'actions/github-script@v9|`@actions/github`|getOctokit' .github/workflows/precheck.yml
# Expect no require("`@actions/github`") usage after the fix.

Repository: sshiv012/texera

Length of output: 1106


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

printf '%s\n' '--- workflow context ---'
sed -n '90,115p;345,385p' .github/workflows/precheck.yml

printf '%s\n' '--- all relevant references ---'
rg -n -C 4 'actions/github-script@v9|`@actions/github`|getOctokit|EVAL_STATUS_TOKEN' .github

Repository: sshiv012/texera

Length of output: 23290


🌐 Web query:

actions/github-script v9 getOctokit require("@actions/github") ESM

💡 Result:

In actions/github-script v9, you can no longer use require("@actions/github") because the underlying @actions/github package has been upgraded to an ESM-only version [1][2]. Attempting to use require in your scripts will cause a runtime error [1][3]. Instead of importing getOctokit manually, you must use the getOctokit factory function that is now automatically injected directly into the script context [1][2]. Key details for v9: 1. No Imports Required: The getOctokit function is available globally within your script context, similar to github, context, and core [2][4]. 2. Breaking Change: You must remove any existing code that attempts to import or require getOctokit from @actions/github [1][3]. 3. Syntax Caution: Because getOctokit is injected as a function parameter, you cannot declare it using const or let (e.g., const getOctokit =...), as this will trigger a SyntaxError due to redeclaration [2][5]. You should either use the injected function directly or use var if you absolutely need to shadow the variable name [1][2]. Example usage: // Use the injected getOctokit function directly const appOctokit = getOctokit(process.env.MY_TOKEN); // To support custom options (e.g., base URL) const ghesOctokit = getOctokit(process.env.GHES_TOKEN, { baseUrl: 'https://github.example.com/api/v3' });

Citations:


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

python3 - <<'PY'
from pathlib import Path

path = Path(".github/workflows/precheck.yml")
text = path.read_text()
step = text[text.index("uses: actions/github-script@v9", text.index("id: decide")):]
step = step[:step.index("\n      - ", 1)] if "\n      - " in step[1:] else step

has_v9 = "uses: actions/github-script@v9" in step
has_bad_import = 'require("`@actions/github`")' in step
uses_injected_factory = "const status = getOctokit(statusToken);" in step
status_call = "await status.rest.repos.createCommitStatus({" in step

print({
    "decide_step_uses_github_script_v9": has_v9,
    "decide_step_requires_actions_github": has_bad_import,
    "decide_step_uses_injected_getOctokit": uses_injected_factory,
    "decide_step_calls_createCommitStatus": status_call,
})
if not (has_v9 and has_bad_import and uses_injected_factory and status_call):
    raise SystemExit("expected failing status-token path was not found")
PY

Repository: sshiv012/texera

Length of output: 334


Use the injected getOctokit factory.

When EVAL_STATUS_TOKEN is set, require("@actions/github") fails in actions/github-script@v9 because @actions/github is ESM-only.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/precheck.yml around lines 368 - 369, Update the workflow’s
status-token handling to use the injected getOctokit factory directly instead of
requiring `@actions/github`. Preserve the existing status creation flow while
ensuring it works when EVAL_STATUS_TOKEN is set under actions/github-script@v9.

await status.rest.repos.createCommitStatus({
owner: context.repo.owner,
repo: context.repo.repo,
sha: context.sha,
state: "success",
context: "precheck / stacks",
description: selected || "no stacks",
});
Comment on lines +370 to +377

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- workflow lines 80-120 ---'
sed -n '80,120p' .github/workflows/precheck.yml

printf '%s\n' '--- workflow lines 330-390 ---'
sed -n '330,390p' .github/workflows/precheck.yml

printf '%s\n' '--- relevant identifiers and permissions ---'
rg -n -C 3 'EVAL_STATUS_TOKEN|createCommitStatus|github-script|permissions:|statuses:|getOctokit|core\.warning|selected' .github/workflows/precheck.yml

Repository: sshiv012/texera

Length of output: 7571


🏁 Script executed:

#!/bin/bash
set -euo pipefail

python3 - <<'PY'
from pathlib import Path
p = Path(".github/workflows/precheck.yml")
text = p.read_text()
for i, line in enumerate(text.splitlines(), 1):
    if "EVAL_STATUS_TOKEN" in line or "createCommitStatus" in line or "actions/github-script" in line:
        print(f"{i}: {line}")
PY

Repository: sshiv012/texera

Length of output: 445


🌐 Web query:

GitHub Actions github-script v9 getOctokit core.warning error handling createCommitStatus fine-grained token Commit statuses write

💡 Result:

In actions/github-script v9, getOctokit is an injected function parameter available directly in the script context, intended for creating additional authenticated Octokit clients [1][2]. Because it is a function parameter, you must not redeclare it using const or let, as doing so will cause a SyntaxError; use the injected function directly or use var if redeclaration is strictly necessary [1][3]. Regarding your query about error handling and fine-grained tokens for creating commit statuses: 1. Commit Status Permissions: To create commit statuses via the GitHub API, your token requires the Commit statuses permission set to Read and Write [4]. If using a fine-grained personal access token (PAT), you must explicitly grant this permission under the Repository permissions section [5][4]. Note that even if a token is correctly configured, you must also ensure the account associated with that token has the appropriate write access to the specific repository [4]. 2. Error Handling with core.warning: You can use the injected core object to handle errors or provide feedback in your workflow logs. For example: try { await github.rest.repos.createCommitStatus({ owner: context.repo.owner, repo: context.repo.repo, sha: context.sha, state: 'success', context: 'my-status' }); } catch (error) { core.warning(Failed to create commit status: ${error.message}); } 3. Troubleshooting 404/Function Errors: - Use createCommitStatus: Ensure you are using github.rest.repos.createCommitStatus (not createStatus) and that you provide the required owner, repo, and sha parameters [6][7]. - Context Issues: If you receive a 404 error, verify that the SHA provided is correct and exists within the repository [6]. If triggering from a pull request, you may need to use context.payload.pull_request.head.sha instead of context.sha [6]. - Token Limitations: Fine-grained tokens behave differently than classic PATs in some API scenarios; ensure the permissions are scoped correctly for the repository and the specific API endpoints you are accessing [5][4]. Finally, note that in v9, require('@actions/github') no longer works due to the upgrade to an ESM-only package, which is why the injected getOctokit should be used for secondary clients [1][2].

Citations:


🏁 Script executed:

#!/bin/bash
set -euo pipefail

sed -n '80,120p' .github/workflows/precheck.yml
sed -n '330,390p' .github/workflows/precheck.yml
rg -n -C 3 'EVAL_STATUS_TOKEN|createCommitStatus|github-script|permissions:|statuses:|getOctokit|core\.warning|selected' .github/workflows/precheck.yml

Repository: sshiv012/texera

Length of output: 7465


🏁 Script executed:

#!/bin/bash
set -euo pipefail

tmpdir="$(mktemp -d)"
trap 'rm -rf "$tmpdir"' EXIT

curl -fsSL https://raw.githubusercontent.com/actions/github-script/v9.0.0/src/main.ts -o "$tmpdir/main.ts"
curl -fsSL https://raw.githubusercontent.com/actions/github-script/v9.0.0/action.yml -o "$tmpdir/action.yml"
curl -fsSL https://raw.githubusercontent.com/actions/github-script/v9.0.0/package.json -o "$tmpdir/package.json"

printf '%s\n' '--- action.yml ---'
cat "$tmpdir/action.yml"

printf '%s\n' '--- main.ts execution wrapper ---'
rg -n -C 8 'getOctokit|callAsyncFunction|script' "$tmpdir/main.ts"

printf '%s\n' '--- package exports and dependencies ---'
rg -n -C 4 '"`@actions/github`"|"type"|"exports"|"main"' "$tmpdir/package.json"

Repository: sshiv012/texera

Length of output: 5741


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- stack decision assignments and outputs ---'
rg -n -C 4 'run[A-Z]|setOutput\("run_' .github/workflows/precheck.yml

printf '%s\n' '--- downstream consumers of decide outputs ---'
rg -n -C 3 'needs\.decide|run_[a-z_]+'

Repository: sshiv012/texera

Length of output: 4022


🏁 Script executed:

#!/bin/bash
set -euo pipefail

tmpdir="$(mktemp -d)"
trap 'rm -rf "$tmpdir"' EXIT

curl -fsSL https://raw.githubusercontent.com/actions/github-script/v9.0.0/src/main.ts -o "$tmpdir/main.ts"
curl -fsSL https://raw.githubusercontent.com/actions/github-script/v9.0.0/action.yml -o "$tmpdir/action.yml"
curl -fsSL https://raw.githubusercontent.com/actions/github-script/v9.0.0/package.json -o "$tmpdir/package.json"

rg -n -C 8 'getOctokit|callAsyncFunction|script' "$tmpdir/main.ts"
rg -n -C 4 '"`@actions/github`"|"type"|"exports"|"main"' "$tmpdir/package.json"

Repository: sshiv012/texera

Length of output: 4039


🏁 Script executed:

#!/bin/bash
set -euo pipefail

tmpdir="$(mktemp -d)"
trap 'rm -rf "$tmpdir"' EXIT

curl -fsSL https://raw.githubusercontent.com/actions/github-script/v9.0.0/src/async-function.ts -o "$tmpdir/async-function.ts"
curl -fsSL https://raw.githubusercontent.com/actions/github-script/v9.0.0/src/wrap-require.ts -o "$tmpdir/wrap-require.ts"

printf '%s\n' '--- async-function.ts ---'
cat "$tmpdir/async-function.ts"

printf '%s\n' '--- wrap-require.ts ---'
cat "$tmpdir/wrap-require.ts"

printf '%s\n' '--- JavaScript declaration test ---'
node - <<'JS'
const script = `
  const { getOctokit } = require("`@actions/github`");
  return typeof getOctokit;
`;
try {
  const fn = new Function("getOctokit", "require", script);
  console.log("compiled:", fn(() => {}, () => ()));
} catch (error) {
  console.log("error:", error.name, error.message);
}
JS

Repository: sshiv012/texera

Length of output: 2364


🏁 Script executed:

#!/bin/bash
set -euo pipefail

node - <<'JS'
const AsyncFunction = Object.getPrototypeOf(async () => null).constructor;
const source = `
  const { getOctokit } = require("`@actions/github`");
  return typeof getOctokit;
`;

try {
  const fn = new AsyncFunction(
    "require",
    "github",
    "octokit",
    "getOctokit",
    "context",
    "core",
    "exec",
    "glob",
    "io",
    source,
  );
  fn(() => ({}), {}, {}, () => {}, {}, {}, {}, {}, {});
  console.log("compiled");
} catch (error) {
  console.log(`${error.name}: ${error.message}`);
}
JS

Repository: sshiv012/texera

Length of output: 216


Fix the status block before publishing the commit status.

The script redeclares the injected getOctokit, so actions/github-script@v9 throws SyntaxError: Identifier 'getOctokit' has already been declared on every run. Call the injected getOctokit(statusToken) directly. Catch createCommitStatus errors when the token is optional. Include all nine selected stack flags in the description.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/precheck.yml around lines 370 - 377, Update the
commit-status publishing block to use the injected getOctokit directly with
statusToken, removing its redeclaration. Catch createCommitStatus failures when
the token is optional, and build the description from all nine selected stack
flags rather than only selected or “no stacks”.

} else {
core.info("No status token available; skipping the stack-decision status.");
}