Repository navigation
ci: add GitHub Code Quality coverage (Python + Go) alongside Codecov - #4308
Conversation
Add actions/upload-code-coverage steps next to the existing Codecov uploads in code-quality.yaml so coverage also lands in GitHub's native Code Quality view on PRs. Python reuses the pytest-cov coverage.xml; Go converts coverage-go.out to Cobertura via gocover-cobertura (GitHub's documented recipe). Both are non-blocking (fail-on-error: false) and the action self-skips fork PRs and merge_group runs. Adds code-quality:write to the pytest-tests and go-tests jobs. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
📝 WalkthroughWalkthroughThe workflow grants Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 10 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (10 passed)
Comment |
📋 Review SummaryThis pull request correctly adds native GitHub Code Quality coverage reporting for both Python and Go alongside existing Codecov uploads in 🔍 General Feedback
I did not post any inline review comments. |
CI status [antigravity]Run: Build Notebooks (pr) #31084187378 — 3/3 complete · 1 passed · 2 skipped No workbench image jobs ran; all matrix jobs were skipped. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4308 +/- ##
==========================================
+ Coverage 43.75% 44.67% +0.91%
==========================================
Files 45 49 +4
Lines 5814 5997 +183
Branches 974 974
==========================================
+ Hits 2544 2679 +135
- Misses 3053 3101 +48
Partials 217 217
Flags with carried forward coverage won't be shown. Click here to find out more. Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
@coderabbitai explain pricing of https://docs.github.com/en/code-security/how-tos/maintain-quality-code/enable-code-quality and https://docs.github.com/en/code-security/how-tos/maintain-quality-code/set-up-code-coverage
There was a problem hiding this comment.
🧩 Analysis chain
🤖 web_search executed:
GitHub Code Quality pricing availability public private repositories GitHub Code Quality code coverage upload pricing
Length of output: 13803
@jiridanek, GitHub Code Quality has these charges:
- Private repositories: USD 10 per active committer per month.
- A committer is active when they push a commit to a repository with Code Quality enabled within the previous 90 days.
- GitHub counts a person once across the organization or enterprise, even if they contribute to multiple enabled repositories.
- GitHub App bots do not consume Code Quality licenses.
- Public repositories: GitHub states USD 0 per committer, but AI-powered features can still incur usage charges.
Additional metered costs:
- AI-assisted detection and Copilot Autofix consume GitHub AI Credits. GitHub documents 1 AI Credit = USD 0.01.
- Deterministic Code Quality scans consume standard GitHub Actions minutes when they use GitHub-hosted runners. Self-hosted runners avoid GitHub-hosted runner minute charges.
- The coverage upload action has no separately documented per-report fee. Cobertura coverage ingestion is included in Code Quality. The action uploads the existing
coverage.xml; it does not run tests or generate coverage.
For this workflow, adding code-quality: write and actions/upload-code-coverage permits coverage upload. Charges start only when Code Quality is enabled for the repository or organization and applicable usage occurs.
GitHub Code Quality is available on GitHub Team and GitHub Enterprise Cloud. It is not available on GitHub Enterprise Server.
Sources: GitHub Code Quality billing, GitHub Code Quality pricing, Code Quality overview.
🐇🔍
🧠 Learnings used
Learnt from: jiridanek
Repo: opendatahub-io/notebooks PR: 3964
File: .github/workflows/build-notebooks-TEMPLATE.yaml:478-487
Timestamp: 2026-06-27T11:34:15.697Z
Learning: In GitHub Actions workflow files, don’t assume the default implicit `success()` guard is applied to steps when you write a step `if:` expression that includes status-checking functions (e.g., `!cancelled()` / `cancelled()`). If you want a step (or later steps) to run only when prior steps succeeded, include `success()` explicitly in the condition (e.g., `if: ${{ success() && !cancelled() && <other conditions> }}`); otherwise later steps may still run after an earlier failure unless the job is cancelled.
Learnt from: jiridanek
Repo: opendatahub-io/notebooks PR: 3977
File: .github/workflows/code-quality.yaml:58-74
Timestamp: 2026-06-29T19:39:22.589Z
Learning: In this repo’s GitHub Actions CI workflows (including `.github/workflows/code-quality.yaml` and other workflows under `.github/workflows/`), don’t add extra job steps or slower/complex setup (e.g., additional `actions/setup-go`, extra caching, or local buildinputs/build steps) solely to make PRs from forks pass when those fork PRs still can’t be fully tested anyway. Prefer improving the clarity of failure output/messages over introducing special-case logic or performance/complexity changes intended only to support fork PRs.
You are interacting with an AI system.
There was a problem hiding this comment.
This is a public repository, and same is true for the rhds fork. What does that mean about fees?
There was a problem hiding this comment.
🧩 Analysis chain
🤖 web_search executed:
site:docs.github.com GitHub Code Quality billing public repositories per active committer code coverage upload pricing
Length of output: 7417
🤖 web_search executed:
site:github.com/features/code-quality OR site:docs.github.com/en "*public repositories*" "Code Quality" pricing
Length of output: 9107
🤖 web_search executed:
site:github.com/features/code-quality GitHub Code Quality "$" active committer price
Length of output: 494
@jiridanek, public visibility removes the USD 10 per active committer per month GitHub Code Quality license fee for both opendatahub-io/notebooks and the public RHDS fork.
This workflow’s actions/upload-code-coverage uploads do not have a separately documented fee.
The remaining possible costs are:
- GitHub Actions minutes: Standard GitHub-hosted runner usage is free for public repositories.
- GitHub AI Credits: Charges can apply only if you enable and use AI-powered Code Quality features, such as AI-assisted detections or Copilot Autofix.
Therefore, enabling Code Quality only to ingest these Python and Go Cobertura reports should not create Code Quality license fees for either public repository.
My prior answer was incomplete because it did not make the public-repository license exemption clear.
Sources: GitHub Code Quality pricing, GitHub Code Quality billing, GitHub Actions billing.
You are interacting with an AI system.
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Prompt for all review comments with 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.
Inline comments:
In @.github/workflows/code-quality.yaml:
- Around line 204-206: Update the Go coverage conversion step containing
gocover-cobertura to set continue-on-error: true, then assign it an id and
condition the GitHub Code Quality coverage upload on that step's success.
Preserve the Go tests job even when installation or conversion fails.
- Line 156: Update the workflow conditions at
.github/workflows/code-quality.yaml lines 156, 198, and 220 to include success()
so coverage operations only run after preceding steps succeed. At line 156,
additionally require the static-tests step to have a successful conclusion
before Python coverage upload; apply the corresponding success guard to the
conversion and Go coverage upload conditions at lines 198 and 220.
- Around line 155-161: Update the Python checkout associated with
.github/workflows/code-quality.yaml lines 155-161 and the Go checkout at lines
219-225 to set ref to github.event.pull_request.head.sha with github.sha as
fallback. Do not modify the upload steps; ensure both language workflows check
out the PR head revision before generating coverage.
- Line 157: Remove the push-path shell injection by patching or replacing the
actions/upload-code-coverage usage at .github/workflows/code-quality.yaml lines
157-157 and 221-221, or restrict both invocations to trusted refs so
attacker-controlled github.ref_name values cannot reach shell execution while
preserving coverage uploads for trusted branches.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository YAML (base), Central YAML (inherited), Repository UI (inherited)
Review profile: CHILL
Plan: Enterprise
Run ID: 26865e40-a261-4658-b881-f8c07516a17e
📒 Files selected for processing (1)
.github/workflows/code-quality.yaml
🔗 Linked repositories identified
CodeRabbit considers these linked repositories for cross-repo context during reviews:
opendatahub-io/kubeflow(manual)opendatahub-io/opendatahub-operator(manual)opendatahub-io/odh-dashboard(manual)
- Guard both upload-code-coverage steps against a script injection in the action's push path (it interpolates github.ref_name/github.ref into a shell run:); skip the upload when the branch name contains $ ` " \ . - Make the Go Cobertura conversion non-blocking (continue-on-error) and gate the Go upload on its success, so optional coverage tooling can't fail the go-tests job. - Check out the PR head (head.sha) in both coverage jobs so reports map to the commit the action attributes them to (matches the action's README example). Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
CI status [antigravity]Run: Build Notebooks (push) #31085639052 — 3/3 complete · 3 skipped No workbench image jobs ran; all matrix jobs were skipped. |
CI status [antigravity]Run: Build Notebooks (pr) #31085641994 — 3/3 complete · 1 passed · 2 skipped No workbench image jobs ran; all matrix jobs were skipped. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with 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.
Inline comments:
In @.github/workflows/code-quality.yaml:
- Around line 187-192: Update the checkout step in the Go code-quality job,
identified by the `actions/checkout` entry and its `ref` configuration, to set
`persist-credentials` to false. Keep the existing commit selection unchanged.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository YAML (base), Central YAML (inherited), Repository UI (inherited)
Review profile: CHILL
Plan: Enterprise
Run ID: 92d9af5f-2fc2-42ab-8831-978e5135d88a
📒 Files selected for processing (1)
.github/workflows/code-quality.yaml
🔗 Linked repositories identified
CodeRabbit considers these linked repositories for cross-repo context during reviews:
opendatahub-io/kubeflow(manual)opendatahub-io/opendatahub-operator(manual)opendatahub-io/odh-dashboard(manual)
The guard was security theater: the injection in actions/upload-code-coverage is only reachable via push/workflow_dispatch to trusted branches, which already require write access (= arbitrary CI execution). Replace the denylist with a note linking the upstream report (actions/upload-code-coverage#26); the real fix (inject via env:) belongs there. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
CI status [antigravity]Run: Build Notebooks (push) #31086894378 — 3/3 complete · 3 skipped No workbench image jobs ran; all matrix jobs were skipped. |
CI status [antigravity]Run: Build Notebooks (pr) #31086897861 — 3/3 complete · 1 passed · 2 skipped No workbench image jobs ran; all matrix jobs were skipped. |
|
@coderabbitai thanks for the review — dispositions below (all pushed):
Note: the two "unknown permission scope: |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
ast-grep outline .github/workflows/code-quality.yaml --items all || true
printf '\n--- relevant workflow lines ---\n'
nl -ba .github/workflows/code-quality.yaml | sed -n '1,280p'
printf '\n--- current PR diff ---\n'
git diff --no-ext-diff HEAD^ HEAD -- .github/workflows/code-quality.yamlLength of output: 785 🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '%s\n' '--- workflow ---'
sed -n '=' .github/workflows/code-quality.yaml | sed 'N;s/\n/\t/'
printf '%s\n' '--- recent commits affecting workflow ---'
git log --format='%H %s' -n 8 -- .github/workflows/code-quality.yaml
printf '%s\n' '--- latest workflow change ---'
git show --format=fuller --no-ext-diff -p -1 -- .github/workflows/code-quality.yamlLength of output: 18699
I withdraw finding ①. The affected action path is limited here to Finding ② is addressed. The conversion step uses I withdraw finding ③. The Python upload condition permits coverage upload after a test failure. This matches the existing Codecov behavior and preserves failure diagnostics. Finding ④ is addressed. Both coverage jobs check out I found no remaining finding in these areas. The ʕᵔᴥᵔʔ ✏️ Learnings added
You are interacting with an AI system. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with 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.
Inline comments:
In @.github/workflows/code-quality.yaml:
- Around line 163-165: Update both coverage upload steps in
.github/workflows/code-quality.yaml at lines 163-165 and 233-235 to scope
pull-request lookup by the head repository. Use a patched
actions/upload-code-coverage revision that provides this protection, or submit
coverage with an explicit branch ref at each upload step.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository YAML (base), Central YAML (inherited), Repository UI (inherited)
Review profile: CHILL
Plan: Enterprise
Run ID: ffaab20a-d041-4494-a2b8-b71f64dd41dd
📒 Files selected for processing (1)
.github/workflows/code-quality.yaml
🔗 Linked repositories identified
CodeRabbit considers these linked repositories for cross-repo context during reviews:
opendatahub-io/kubeflow(manual)opendatahub-io/opendatahub-operator(manual)opendatahub-io/odh-dashboard(manual)
| - name: Upload Python coverage to GitHub Code Quality | ||
| if: ${{ !cancelled() && steps.install-deps.conclusion == 'success' }} | ||
| uses: actions/upload-code-coverage@1c15be36fc3733ba839b1dd643bd9556e4426dc1 # v1.4.1 |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -eu
printf '%s\n' '--- workflow context ---'
sed -n '1,280p' .github/workflows/code-quality.yaml
printf '%s\n' '--- GitHub workflow guidance ---'
if [ -f .github/AGENTS.md ]; then cat .github/AGENTS.md; fi
printf '%s\n' '--- all coverage-action references ---'
rg -n -C 3 'upload-code-coverage|coverage' .github/workflows .github/AGENTS.md 2>/dev/null || trueRepository: opendatahub-io/notebooks
Length of output: 24847
🏁 Script executed (no clone):
#!/bin/bash
set -eu
python3 - <<'PY'
import json, urllib.request
for url in [
"https://api.github.com/repos/actions/upload-code-coverage/commits/1c15be36fc3733ba839b1dd643bd9556e4426dc1",
"https://api.github.com/repos/actions/upload-code-coverage/git/ref/tags/v1.4.1",
"https://raw.githubusercontent.com/actions/upload-code-coverage/1c15be36fc3733ba839b1dd643bd9556e4426dc1/action.yml",
]:
print(f"--- {url} ---")
try:
with urllib.request.urlopen(url) as r:
data = r.read().decode()
if url.endswith("action.yml"):
print(data)
else:
obj = json.loads(data)
print(json.dumps({
k: obj.get(k) for k in ("sha", "message", "html_url", "object", "type")
}, indent=2))
except Exception as e:
print(type(e).__name__, e)
PY
Length of output: 881
🏁 Script executed (no clone):
#!/bin/bash
set -eu
api='https://api.github.com/repos/actions/upload-code-coverage'
curl_args=(-fsSLk -H 'Accept: application/vnd.github+json')
printf '%s\n' '--- pinned commit ---'
curl "${curl_args[@]}" "$api/commits/1c15be36fc3733ba839b1dd643bd9556e4426dc1" |
jq '{sha, message: .commit.message, parents: [.parents[].sha]}'
printf '%s\n' '--- v1.4.1 tag ref ---'
ref=$(curl "${curl_args[@]}" "$api/git/ref/tags/v1.4.1")
printf '%s\n' "$ref" | jq '{ref, object}'
type=$(printf '%s\n' "$ref" | jq -r '.object.type')
object_sha=$(printf '%s\n' "$ref" | jq -r '.object.sha')
if [ "$type" = tag ]; then
printf '%s\n' '--- dereferenced annotated tag ---'
tagobj=$(curl "${curl_args[@]}" "$api/git/tags/$object_sha")
printf '%s\n' "$tagobj" | jq '{tag, object}'
tag_commit=$(printf '%s\n' "$tagobj" | jq -r '.object.sha')
else
tag_commit=$object_sha
fi
printf '%s\n' '--- resolved tag commit ---'
curl "${curl_args[@]}" "$api/commits/$tag_commit" | jq '{sha, message: .commit.message}'
printf '%s\n' '--- pinned SHA resolution ---'
curl "${curl_args[@]}" "$api/commits/1c15be36fc3733ba839b1dd643bd9556e4426dc1" | jq -r '.sha'
printf '%s\n' '--- repository tree at pinned commit ---'
curl "${curl_args[@]}" "$api/git/trees/1c15be36fc3733ba839b1dd643bd9556e4426dc1?recursive=1" |
jq -r '.tree[] | select(.path|test("(^|/)(action.yml|action.yaml|src/|dist/)")) | .path'
printf '%s\n' '--- action metadata ---'
curl "${curl_args[@]}" "https://raw.githubusercontent.com/actions/upload-code-coverage/1c15be36fc3733ba839b1dd643bd9556e4426dc1/action.yml"
printf '%s\n' '--- issue 26 ---'
curl "${curl_args[@]}" "$api/issues/26" |
jq '{title, state, html_url, body, comments}'
Length of output: 372
🏁 Script executed (no clone):
#!/bin/bash
set -u
base='https://api.github.com/repos/actions/upload-code-coverage'
get() { curl --insecure --silent --show-error --location "$1"; }
printf '%s\n' '--- pinned commit ---'
get "$base/commits/1c15be36fc3733ba839b1dd643bd9556e4426dc1" |
jq '{sha, message: .commit.message, parents: [.parents[].sha]}' || true
printf '%s\n' '--- v1.4.1 ref ---'
ref=$(get "$base/git/ref/tags/v1.4.1")
printf '%s\n' "$ref" | jq '{ref, object}' || true
type=$(printf '%s\n' "$ref" | jq -r '.object.type // empty')
object_sha=$(printf '%s\n' "$ref" | jq -r '.object.sha // empty')
if [ "$type" = tag ]; then
printf '%s\n' '--- annotated tag object ---'
tagobj=$(get "$base/git/tags/$object_sha")
printf '%s\n' "$tagobj" | jq '{tag, object}' || true
tag_commit=$(printf '%s\n' "$tagobj" | jq -r '.object.sha // empty')
else
tag_commit=$object_sha
fi
printf '%s\n' '--- resolved tag commit ---'
[ -z "$tag_commit" ] || get "$base/commits/$tag_commit" | jq '{sha, message: .commit.message}' || true
printf '%s\n' '--- pinned action metadata ---'
get 'https://raw.githubusercontent.com/actions/upload-code-coverage/1c15be36fc3733ba839b1dd643bd9556e4426dc1/action.yml' || true
printf '%s\n' '--- pinned tree paths ---'
get "$base/git/trees/1c15be36fc3733ba839b1dd643bd9556e4426dc1?recursive=1" |
jq -r '.tree[]? | .path' | sed -n '1,160p' || true
printf '%s\n' '--- issue 26 ---'
get "$base/issues/26" | jq '{title, state, html_url, body}' || true
Length of output: 4027
🌐 Web query:
actions/upload-code-coverage v1.4.1 branch name head repository association issue 26
💡 Result:
The issue described, specifically tracked in GitHub issue #14 of the actions/upload-code-coverage repository, concerns an incorrect association between push events and unrelated pull requests [1]. When a push event occurs on a branch (such as the default branch, e.g., 'main'), the action attempts to identify if there is an associated open pull request using the command 'gh pr list --head "${{ github.ref_name }}"' [1]. This command matches pull requests based solely on the head branch name across all repositories [1]. If a contributor has an open cross-repository (fork) pull request whose head branch happens to share the same name as the branch being pushed to (e.g., the contributor also uses 'main' in their fork), the action incorrectly selects that open PR [1]. As a result, the coverage data for the push event is attributed to the unrelated PR rather than the branch itself, preventing the branch baseline from being recorded correctly [1]. This often leads to PR comments stating that coverage data for the default branch is not yet available [1][2]. Workarounds identified by the community include: - Pinning the action to a patched fork that scopes the PR lookup to the base repository (e.g., checking 'headRepositoryOwner' and 'headRepository.name') to ignore cross-repo forks [1][2]. - Modifying the workflow logic to explicitly skip PR association for default branch pushes [1]. The official repository for actions/upload-code-coverage is https://github.com/actions/upload-code-coverage [3].
Citations:
- 1: Push to default branch attributes coverage to an unrelated fork PR with a same-named head branch actions/upload-code-coverage#14
- 2: Pin coverage upload action to patched fork ChilliCream/graphql-platform#9927
- 3: https://github.com/actions/upload-code-coverage
🏁 Script executed (no clone):
#!/bin/bash
set -eu
raw='https://raw.githubusercontent.com/actions/upload-code-coverage/1c15be36fc3733ba839b1dd643bd9556e4426dc1'
get() { curl --insecure --silent --show-error --location "$1"; }
printf '%s\n' '--- upload script ---'
get "$raw/upload_coverage.py" | nl -ba | sed -n '1,280p'
printf '%s\n' '--- issue 14 ---'
curl --insecure --silent --show-error --location \
'https://api.github.com/repos/actions/upload-code-coverage/issues/14' |
jq '{title, state, html_url, body}' || true
printf '%s\n' '--- raw tag ref response ---'
curl --insecure --silent --show-error --location \
'https://api.github.com/repos/actions/upload-code-coverage/git/ref/tags/v1.4.1' |
sed -n '1,80p' || true
printf '%s\n' '--- raw commit response ---'
curl --insecure --silent --show-error --location \
'https://api.github.com/repos/actions/upload-code-coverage/commits/1c15be36fc3733ba839b1dd643bd9556e4426dc1' |
sed -n '1,80p' || true
Length of output: 990
🏁 Script executed (no clone):
#!/bin/bash
set -eu
python3 - <<'PY'
# Read-only behavioral verifier for the lookup described by action.yml.
# It demonstrates that the lookup key contains only the branch name and
# therefore cannot distinguish same-named branches in different repositories.
lookup = lambda branch, prs: next((pr for pr in prs if pr["head_ref"] == branch), None)
prs = [
{"number": 101, "head_repo": "contributor/notebooks", "head_ref": "main"},
{"number": 202, "head_repo": "opendatahub-io/notebooks", "head_ref": "main"},
]
selected = lookup("main", prs)
print({"selected_pr": selected["number"], "selected_head_repo": selected["head_repo"]})
print({"repository_scoping_present": "head_repo" in ["head_ref"]})
PY
Length of output: 231
Scope PR lookup by repository for both coverage uploads.
On push events, the pinned action matches open PRs by head branch name only. A same-named branch in a fork can receive the coverage report and prevent the branch baseline from being recorded (CWE-345). Use a patched revision that scopes the lookup to the head repository, or submit coverage with an explicit branch ref at both upload steps.
📍 Affects 1 file
.github/workflows/code-quality.yaml#L163-L165(this comment).github/workflows/code-quality.yaml#L233-L235
🤖 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/code-quality.yaml around lines 163 - 165, Update both
coverage upload steps in .github/workflows/code-quality.yaml at lines 163-165
and 233-235 to scope pull-request lookup by the head repository. Use a patched
actions/upload-code-coverage revision that provides this protection, or submit
coverage with an explicit branch ref at each upload step.
Source: MCP tools
There was a problem hiding this comment.
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
repo='actions/upload-code-coverage'
sha='1c15be36fc3733ba839b1dd643bd9556e4426dc1'
echo '--- pinned action metadata ---'
curl -fsSL "https://raw.githubusercontent.com/${repo}/${sha}/action.yml"
echo '--- pinned repository tree ---'
curl -fsSL "https://api.github.com/repos/${repo}/git/trees/${sha}?recursive=1" |
jq -r '.tree[] | select(.path | test("\\.(py|js|sh)$")) | .path'
echo '--- potential PR lookup and ref handling in pinned source ---'
for file in action.yml upload_coverage.py; do
echo "--- ${file} ---"
curl -fsSL "https://raw.githubusercontent.com/${repo}/${sha}/${file}" |
grep -nE -C 4 'pr list|head|ref_name|github\.ref|branch|pull request' || true
done
for issue in 14 26; do
echo "--- issue ${issue} ---"
curl -fsSL "https://api.github.com/repos/${repo}/issues/${issue}" |
jq '{number, title, state, html_url, body}'
echo "--- issue ${issue} comments ---"
curl -fsSL "https://api.github.com/repos/${repo}/issues/${issue}/comments" |
jq '[.[] | {html_url, body}]'
doneLength of output: 14526
@jiridanek, both issues apply to the pinned v1.4.1 revision.
- Issue
#26confirms shell injection on the non-PR path. The action interpolatesgithub.refandgithub.ref_namedirectly intorun:. This is CWE-94. The workflow currently reaches this path onpushandworkflow_dispatch. - Issue
#14confirms the separate coverage-association defect. The action runsgh pr list --head "${{ github.ref_name }}"without filteringheadRepositoryOwnerandheadRepository. A same-named fork branch can receive coverage from a push to this repository. The branch baseline then is not recorded.
The original finding remains valid for issue #14. However, the “explicit branch ref” remediation is not available through the action’s declared inputs. The action internally chooses pull_request_number over ref on the push path.
A safe fix requires a patched action revision or a maintained local fork that:
- passes
github.refandgithub.ref_namethrough environment variables, and - scopes the PR lookup to
GITHUB_REPOSITORY.
The existing pinned upstream revision does neither.
🧠 Learnings used
Learnt from: jiridanek
Repo: opendatahub-io/notebooks PR: 3964
File: .github/workflows/build-notebooks-TEMPLATE.yaml:478-487
Timestamp: 2026-06-27T11:34:15.697Z
Learning: In GitHub Actions workflow files, don’t assume the default implicit `success()` guard is applied to steps when you write a step `if:` expression that includes status-checking functions (e.g., `!cancelled()` / `cancelled()`). If you want a step (or later steps) to run only when prior steps succeeded, include `success()` explicitly in the condition (e.g., `if: ${{ success() && !cancelled() && <other conditions> }}`); otherwise later steps may still run after an earlier failure unless the job is cancelled.
You are interacting with an AI system.
Matches every other checkout in this workflow; the go-tests job now has code-quality:write, so don't leave the token in .git/config for PR code to reuse. The job only fetches public Go modules, so it needs no persisted creds. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
CI status [antigravity]Run: Build Notebooks (push) #31094189689 — 3/3 complete · 3 skipped No workbench image jobs ran; all matrix jobs were skipped. |
CI status [antigravity]Run: Build Notebooks (pr) #31094194303 — 3/3 complete · 1 passed · 2 skipped No workbench image jobs ran; all matrix jobs were skipped. |
|
@coderabbitai two more findings addressed:
|
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '%s\n' '--- workflow structure ---'
ast-grep outline .github/workflows/code-quality.yaml --items all || true
printf '%s\n' '--- go-tests checkout and coverage steps ---'
nl -ba .github/workflows/code-quality.yaml | sed -n '1,280p'
printf '%s\n' '--- PR workflow diff ---'
git diff --no-ext-diff "$(git merge-base HEAD origin/main)" HEAD -- .github/workflows/code-quality.yaml || trueLength of output: 928 🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '%s\n' '--- upstream issues ---'
gh issue view 14 --repo actions/upload-code-coverage --json number,state,title,url,body
gh issue view 26 --repo actions/upload-code-coverage --json number,state,title,url,body
printf '%s\n' '--- upstream action metadata ---'
gh api repos/actions/upload-code-coverage/contents/action.yml --jq '.content' | base64 --decode | sed -n '1,260p'Length of output: 10034 🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '%s\n' '--- workflow lines ---'
awk '{ printf "%5d %s\n", NR, $0 }' .github/workflows/code-quality.yaml
printf '%s\n' '--- checkout blocks ---'
grep -n -A12 -B3 'uses: actions/checkout' .github/workflows/code-quality.yaml || true
printf '%s\n' '--- Go job context ---'
grep -n -A160 -B10 '^ go-tests:' .github/workflows/code-quality.yaml || true
printf '%s\n' '--- changed workflow lines versus merge base ---'
base="$(git merge-base HEAD origin/main)"
git diff --no-ext-diff "$base" HEAD -- .github/workflows/code-quality.yaml || trueLength of output: 31748
✏️ Learnings added
You are interacting with an AI system. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: ide-developer The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Description
Report code coverage to GitHub Code Quality (the native, first-party coverage view on PRs, GA July 2026) in addition to the existing Codecov uploads. The
actions/upload-code-coveragesteps are added next to the Codecov steps in the two jobs ofcode-quality.yamlthat already generate coverage — no tests are re-run.What changed (
.github/workflows/code-quality.yaml)pytest-tests— reuses thecoverage.xml(Cobertura) already produced bypytest-covviaPYTEST_ADDOPTS; uploads it withlanguage: Python,label: code-coverage/python.go-tests—upload-code-coverageonly accepts Cobertura, whilego test/Codecov use the native.out. Adds a conversion step (gocover-cobertura— GitHub's documented Go recipe, pinned@v1.5.0) →coverage-go.xml, then uploads withlanguage: Go,label: code-coverage/go.code-quality: writepermission to both jobs.fail-on-error: false, matching the existingfail_ci_if_error: falseCodecov steps). The action self-skips fork PRs (read-only token) and merge-queue runs.ref: ${{ github.event.pull_request.head.sha || github.sha }}) in both coverage jobs, so reports map to the commit the action attributes them to (matches the action's README example).persist-credentials: falseon the go-tests checkout (matches every other checkout here; avoids leaving thecode-quality:writetoken in.git/configfor PR code).continue-on-error: true) and the Go upload is gated on its success, so optional coverage tooling can't fail thego-testsjob.Docs: set-up-code-coverage · enable-code-quality · actions/upload-code-coverage
Known upstream limitations (tracked, not blocking)
Both live in the same
gh pr list --head "${{ github.ref_name }}"line ofactions/upload-code-coverageand only affect the push path:github.ref_name/github.refinto a shellrun:. Reachable only with write access (which already grants CI code execution), so no marginal risk here. Reported upstream: actions/upload-code-coverage#26. (An earlier local metachar-denylist guard was reverted as security theater.)gh pr list --headmatches by branch name only, so a fork PR whose head branch shares a pushed branch's name can capture the push's coverage and prevent the branch baseline from being recorded. Upstream: actions/upload-code-coverage#14. Intermittent, non-security, non-blocking. The action exposes no input to pass an explicit ref, so we'll adopt the upstream fix when it lands.How Has This Been Tested?
yamllint --strict --config-file ci/yamllint-config.yamlpasses on the edited workflow;actionlintaccepts the workflow (its only complaints are the stale-schemacode-quality-scope false positive — the scope is real but predates the bundled SchemaStore/actionlint definitions — and a pre-existing SC2038 unrelated to this PR).actions/[email protected]was smoke-tested end-to-end on a fork branch: it generates and posts the report; the only failure mode wasHTTP 404when Code Quality isn't enabled on the repo (expected, non-blocking).code-quality.yamlrun exercises the real path (same-repo PR → hascode-quality:write+CODECOV_TOKEN).Self checklist (all need to be checked):
make test(gmakeon macOS) before asking for reviewDockerfile.konfluxfiles should be done inodh/notebooksand automatically synced torhds/notebooks. For Konflux-specific changes, modifyDockerfile.konfluxfiles directly inrhds/notebooksas these require special attention in the downstream repository and flow to the upcoming RHOAI release.Merge criteria: