-
Notifications
You must be signed in to change notification settings - Fork 0
[seed 6636b1] Evaluation change; do not merge #25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: coderabbit-eval/base
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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; | ||
|
|
@@ -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(", "); | ||
| const { getOctokit } = require("@actions/github"); | ||
| const status = getOctokit(statusToken); | ||
|
Comment on lines
+368
to
+369
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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' .githubRepository: sshiv012/texera Length of output: 23290 🌐 Web query:
💡 Result: In actions/github-script v9, you can no longer use require(" 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")
PYRepository: sshiv012/texera Length of output: 334 Use the injected When 🤖 Prompt for AI Agents |
||
| 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
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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.ymlRepository: 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}")
PYRepository: sshiv012/texera Length of output: 445 🌐 Web query:
💡 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( 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.ymlRepository: 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);
}
JSRepository: 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}`);
}
JSRepository: sshiv012/texera Length of output: 216 Fix the status block before publishing the commit status. The script redeclares the injected 🤖 Prompt for AI Agents |
||
| } else { | ||
| core.info("No status token available; skipping the stack-decision status."); | ||
| } | ||
There was a problem hiding this comment.
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, andrunPyrightLanguageService, although the decision code computes and exports these flags. A change that selects only one of these stacks publishesno 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
🤖 Prompt for AI Agents