Skip to content

Add upstream release watcher (workload-identity auth) - #6

Open
aryehlev wants to merge 2 commits into
mainfrom
atuoupdate
Open

Add upstream release watcher (workload-identity auth)#6
aryehlev wants to merge 2 commits into
mainfrom
atuoupdate

Conversation

@aryehlev

@aryehlev aryehlev commented Jul 19, 2026

Copy link
Copy Markdown
Owner

Adds a weekly (and manual) watcher that opens a PR when the upstream library
publishes a newer release than the one pinned in build.rs. Claude reviews the
upstream C API header diff and edits the crate; peter-evans/create-pull-request
opens the PR. The only remote write is the PR itself.

Auth: Anthropic workload identity federation (OIDC) — no stored API key.

Before this can run, add repo secrets: ANTHROPIC_FEDERATION_RULE_ID,
ANTHROPIC_ORGANIZATION_ID, ANTHROPIC_SERVICE_ACCOUNT_ID
(+ ANTHROPIC_WORKSPACE_ID if the federation rule spans multiple workspaces).

Note: the federation rule subject should match this repo\x27s default branch once merged.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Added automated monitoring for newer upstream XGBoost releases.
    • Automatically prepares and opens an update pull request when a newer release is detected.
    • Includes header comparisons, checksum validation, compatibility updates, and CI coverage adjustments in generated update proposals.

aryehlev and others added 2 commits July 19, 2026 22:00
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Swap static ANTHROPIC_API_KEY for OIDC/WIF: add id-token: write and the
anthropic_federation_* inputs.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 19, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

Adds a scheduled and manual workflow that detects newer upstream XGBoost releases, prepares header diffs and checksums, invokes Claude for constrained repository edits, and creates a labeled version-specific pull request.

Changes

Upstream release automation

Layer / File(s) Summary
Workflow triggers and job setup
.github/workflows/upstream-release.yml
Defines weekly and manual execution, required permissions, the update job, and checkout configuration.
Release detection and header artifacts
.github/workflows/upstream-release.yml
Compares pinned and upstream versions, skips duplicate update PRs, downloads headers, and generates diffs, checksums, and PR content.
Constrained edits and pull request creation
.github/workflows/upstream-release.yml
Configures Claude to update version metadata, checksums, safe wrappers, and CI; then ensures labels and opens the pull request.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Scheduler
  participant GitHubActions
  participant XGBoost
  participant Claude
  participant GitHubPR
  Scheduler->>GitHubActions: Trigger weekly or manual workflow
  GitHubActions->>XGBoost: Fetch latest release and headers
  XGBoost-->>GitHubActions: Return release tag and header files
  GitHubActions->>GitHubActions: Compare versions and check open PRs
  GitHubActions->>Claude: Provide diff, checksums, and edit constraints
  Claude->>GitHubActions: Write repository edits and PR body
  GitHubActions->>GitHubPR: Create labeled version-specific pull request
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the new upstream release watcher and highlights the key auth change.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch atuoupdate

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 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/upstream-release.yml:
- Around line 19-22: Add issues: write to the workflow permissions and update
the label-management commands around gh label create to surface failures instead
of swallowing them with || true. Verify label creation succeeds with the default
GITHUB_TOKEN before allowing create-pull-request to rely on the dependencies and
upstream-release labels.
- Around line 57-69: Update the “Skip if an update PR is already open” step to
pass the latest-version value through its env block, then construct BRANCH from
the quoted shell environment variable instead of directly interpolating the
GitHub Actions expression in run. Preserve the existing branch value and PR
lookup behavior; do not address the separate concurrency suggestion.
🪄 Autofix (Beta)

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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e5902e0c-a5c9-41c4-81f4-13dc82a293a4

📥 Commits

Reviewing files that changed from the base of the PR and between 8499753 and 320d7a7.

📒 Files selected for processing (1)
  • .github/workflows/upstream-release.yml

Comment on lines +19 to +22
permissions:
id-token: write # fetch the GitHub OIDC token for Anthropic WIF
contents: write # minimum GitHub allows for creating a PR branch
pull-requests: write # open/update the PR

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

Label creation may silently fail, breaking the labels applied to the final PR.

permissions: (lines 19-22) grants contents, pull-requests, and id-token, but not issues. Repository label management (gh label create, lines 173-174) is exposed under the Issues API, and per community reports even issues: write on GITHUB_TOKEN does not reliably allow creating/updating labels — only a PAT/App token with broader repo write access does. Since the failures here are swallowed by || true, if label creation fails the dependencies/upstream-release labels won't exist, and create-pull-request (line 185) referencing those same label names could then fail or silently drop them, undermining a stated goal of the workflow (labeled PR).

Recommend: add issues: write to permissions: and re-verify gh label create succeeds with the default GITHUB_TOKEN, or drop the || true temporarily to surface the real failure mode before relying on it silently.

#!/bin/bash
# Check whether GITHUB_TOKEN with issues:write can manage repo labels (background reading)
gh api graphql -f query='{ __type(name: "Repository") { name } }' >/dev/null 2>&1; echo done

Also applies to: 168-186

🤖 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/upstream-release.yml around lines 19 - 22, Add issues:
write to the workflow permissions and update the label-management commands
around gh label create to surface failures instead of swallowing them with ||
true. Verify label creation succeeds with the default GITHUB_TOKEN before
allowing create-pull-request to rely on the dependencies and upstream-release
labels.

Source: Linters/SAST tools

Comment on lines +57 to +69
- name: Skip if an update PR is already open
id: existing
if: steps.versions.outputs.update == 'true'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -euo pipefail
BRANCH="chore/xgboost-${{ steps.versions.outputs.latest }}"
if gh pr list --state open --head "$BRANCH" --json number --jq '.[0].number' | grep -q '[0-9]'; then
echo "skip=true" >> "$GITHUB_OUTPUT"
else
echo "skip=false" >> "$GITHUB_OUTPUT"
fi

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Direct ${{ }} expansion into shell string (script injection pattern).

BRANCH="chore/xgboost-${{ steps.versions.outputs.latest }}" interpolates a GitHub Actions expression directly into the run: script rather than through an env var, which is exactly the anti-pattern zizmor flags. latest is derived from the upstream dmlc/xgboost release tag name; while that's a trusted repo today, embedding ${{ }} directly in shell risks arbitrary command injection if that string ever contains shell metacharacters (e.g. via a compromised/malicious upstream tag). The very next step (lines 74-76) already uses the safer pattern (env: + "$VAR") — apply it here too.

🔒 Proposed fix
       - name: Skip if an update PR is already open
         id: existing
         if: steps.versions.outputs.update == 'true'
         env:
           GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+          LATEST: ${{ steps.versions.outputs.latest }}
         run: |
           set -euo pipefail
-          BRANCH="chore/xgboost-${{ steps.versions.outputs.latest }}"
+          BRANCH="chore/xgboost-${LATEST}"
           if gh pr list --state open --head "$BRANCH" --json number --jq '.[0].number' | grep -q '[0-9]'; then

Separately: this check-then-create pattern also has a benign TOCTOU race against concurrent runs (weekly schedule overlapping a manual dispatch) — consider adding a workflow-level concurrency: group keyed on the job to fully close it.

📝 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
- name: Skip if an update PR is already open
id: existing
if: steps.versions.outputs.update == 'true'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -euo pipefail
BRANCH="chore/xgboost-${{ steps.versions.outputs.latest }}"
if gh pr list --state open --head "$BRANCH" --json number --jq '.[0].number' | grep -q '[0-9]'; then
echo "skip=true" >> "$GITHUB_OUTPUT"
else
echo "skip=false" >> "$GITHUB_OUTPUT"
fi
- name: Skip if an update PR is already open
id: existing
if: steps.versions.outputs.update == 'true'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
LATEST: ${{ steps.versions.outputs.latest }}
run: |
set -euo pipefail
BRANCH="chore/xgboost-${LATEST}"
if gh pr list --state open --head "$BRANCH" --json number --jq '.[0].number' | grep -q '[0-9]'; then
echo "skip=true" >> "$GITHUB_OUTPUT"
else
echo "skip=false" >> "$GITHUB_OUTPUT"
fi
🧰 Tools
🪛 zizmor (1.26.1)

[info] 64-64: code injection via template expansion (template-injection): may expand into attacker-controllable code

(template-injection)

🤖 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/upstream-release.yml around lines 57 - 69, Update the
“Skip if an update PR is already open” step to pass the latest-version value
through its env block, then construct BRANCH from the quoted shell environment
variable instead of directly interpolating the GitHub Actions expression in run.
Preserve the existing branch value and PR lookup behavior; do not address the
separate concurrency suggestion.

Source: Linters/SAST tools

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.

1 participant