Skip to content

CNTRLPLANE-3641: add restructure-commits and rebase GHA workflows - #8770

Merged
openshift-merge-bot[bot] merged 1 commit into
openshift:mainfrom
bryan-cox:add-new-gha-jobs
Jun 18, 2026
Merged

openshift-merge-bot[bot] merged 1 commit into
openshift:mainfrom
bryan-cox:add-new-gha-jobs

Conversation

@bryan-cox

@bryan-cox bryan-cox commented Jun 18, 2026

Copy link
Copy Markdown
Member

What this PR does / why we need it:

Adds two new GitHub Actions workflows that can be triggered by PR comments:

  • /restructure-commits — invokes the repo's .claude/commands/restructure-commits.md command via Claude to reorganize branch commits into logical, component-based commits matching HyperShift's architecture.
  • /rebase — uses Claude to rebase the PR branch onto the latest main, resolve any merge conflicts, and force push.

Both workflows follow the same pattern as the existing address-review-comments workflow: concurrency grouping per PR number, member/owner/collaborator authorization, community fork token handling, GCP WIF authentication for Vertex AI, and the same tool dependency setup.

Which issue(s) this PR fixes:

Special notes for your reviewer:

Both workflows are modeled directly after .github/workflows/address-review-comments.yaml with minimal changes to the trigger command and Claude prompt.

Checklist:

  • Subject and description added to both, commit and PR.
  • Relevant issues have been referenced.
  • This change includes docs.
  • This change includes unit tests.

Summary by CodeRabbit

  • New Features
    • Added PR rebase automation that runs when a qualifying “/rebase” command comment is posted.
    • Added commit restructuring automation that runs when a qualifying “/restructure-commits” command comment is posted.
    • Both automations report progress by commenting a link to the workflow run and execute the requested changes on the PR branch.

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Pipeline controller notification
This repo is configured to use the pipeline controller. Second-stage tests will be triggered either automatically or after lgtm label is added, depending on the repository configuration. The pipeline controller will automatically detect which contexts are required and will utilize /test Prow commands to trigger the second stage.

For optional jobs, comment /test ? to see a list of all defined jobs. To trigger manually all jobs from second stage use /pipeline required command.

This repository is configured in: LGTM mode

@coderabbitai

coderabbitai Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

Two new GitHub Actions workflows are added: Rebase PR (.github/workflows/rebase.yaml) and Restructure Commits (.github/workflows/restructure-commits.yaml). Both trigger on issue_comment creation events filtered by the presence of a slash command (/rebase or /restructure-commits) and restricted to MEMBER, OWNER, or COLLABORATOR author associations. Each workflow posts a run link to the PR, resolves the PR head branch and repository via the GitHub API, selects either a fork-specific secret token or the default github.token, checks out the PR branch with full history, authenticates to GCP via Workload Identity Federation, installs Claude Code and Go/pre-commit tooling, then executes a Claude Code command with Vertex AI environment variables, specified plugins, and a constrained --allowedTools list.

Possibly related PRs

  • openshift/hypershift#8702: Both PRs modify GitHub Actions workflows that set up Claude Code by installing the same tooling/plugins (gopls and pre-commit) before running Claude-based tasks.

Suggested reviewers

  • clebs
  • enxebre
  • sdminonne
🚥 Pre-merge checks | ✅ 11
✅ Passed checks (11 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 main changes: adding two GitHub Actions workflows (restructure-commits and rebase) with clear reference to the JIRA ticket.
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.
Stable And Deterministic Test Names ✅ Passed This PR adds GitHub Actions workflow files and doesn't modify any Ginkgo test definitions, so the check for stable test names is not applicable.
Test Structure And Quality ✅ Passed This PR adds only GitHub Actions workflow YAML files, not Ginkgo test code. The check for Ginkgo test structure and quality is not applicable since no tests are included in this PR.
Topology-Aware Scheduling Compatibility ✅ Passed PR adds only GitHub Actions workflows (.github/workflows/), not Kubernetes manifests, operator code, or controllers. Check is not applicable.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed This PR adds GitHub Actions workflow files, not Ginkgo e2e tests. The IPv6 and disconnected network test check applies only to Ginkgo e2e tests, so it is not applicable here.
No-Weak-Crypto ✅ Passed No weak cryptographic algorithms (MD5, SHA1, DES, RC4, 3DES, Blowfish, ECB), custom crypto implementations, or non-constant-time secret comparisons found in the new workflow files.
Container-Privileges ✅ Passed PR adds GitHub Actions workflows, not container/K8s manifests. No privileged configurations, hostPID, hostNetwork, hostIPC, SYS_ADMIN, or allowPrivilegeEscalation found.
No-Sensitive-Data-In-Logs ✅ Passed Workflows properly handle sensitive data: tokens passed via Authorization headers with output redirected to files, environment variables not logged, and only public PR metadata extracted via jq. No...

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@openshift-ci

openshift-ci Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bryan-cox

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 18, 2026
@bryan-cox bryan-cox changed the title ci: add restructure-commits and rebase GHA workflows CNTRLPLANE-3641: add restructure-commits and rebase GHA workflows Jun 18, 2026
@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Jun 18, 2026
@openshift-ci-robot

openshift-ci-robot commented Jun 18, 2026

Copy link
Copy Markdown

@bryan-cox: This pull request references CNTRLPLANE-3641 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the task to target the "5.0.0" version, but no target version was set.

Details

In response to this:

What this PR does / why we need it:

Adds two new GitHub Actions workflows that can be triggered by PR comments:

  • /restructure-commits — invokes the repo's .claude/commands/restructure-commits.md command via Claude to reorganize branch commits into logical, component-based commits matching HyperShift's architecture.
  • /rebase — uses Claude to rebase the PR branch onto the latest main, resolve any merge conflicts, and force push.

Both workflows follow the same pattern as the existing address-review-comments workflow: concurrency grouping per PR number, member/owner/collaborator authorization, community fork token handling, GCP WIF authentication for Vertex AI, and the same tool dependency setup.

Which issue(s) this PR fixes:

Special notes for your reviewer:

Both workflows are modeled directly after .github/workflows/address-review-comments.yaml with minimal changes to the trigger command and Claude prompt.

Checklist:

  • Subject and description added to both, commit and PR.
  • Relevant issues have been referenced.
  • This change includes docs.
  • This change includes unit tests.

Summary by CodeRabbit

  • New Features
  • Pull request rebase automation is now available
  • Commit restructuring automation for pull requests is now available

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
.github/workflows/rebase.yaml (1)

68-71: ⚖️ Poor tradeoff

Supply chain risk: unpinned installer script.

The Claude Code installation fetches and executes a script from https://claude.ai/install.sh without checksum verification. If the remote script is compromised, it could execute arbitrary code in the CI environment. This is a common trade-off for convenience, but worth noting given the workflow's elevated permissions.

Consider documenting this accepted risk or pinning to a specific Claude Code version if available.

🤖 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/rebase.yaml around lines 68 - 71, The "Install Claude
Code" step downloads and executes an installer script from
https://claude.ai/install.sh without verifying its integrity, creating a supply
chain risk if the remote source is compromised. Either add checksum verification
to the curl command by capturing the script hash and comparing it against a
known value before execution, or investigate if Claude Code provides a pinned
version installation method and use that instead. If accepting this risk is
intentional due to convenience trade-offs, add a comment explaining the accepted
risk and why it was chosen despite the security implications.
🤖 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/rebase.yaml:
- Around line 44-51: The "Select token for PR repo" step has a template
injection vulnerability where steps.pr.outputs.repo is directly interpolated
into the bash script conditional. To fix this, move the GitHub context variable
steps.pr.outputs.repo into an environment variable before the run block, then
reference the environment variable within the bash script instead of using
direct template expansion with double curly braces. This prevents potential
command injection if the repository name contains special characters.

In @.github/workflows/restructure-commits.yaml:
- Around line 44-51: The bash conditional in the "Select token for PR repo" step
contains a template injection risk by directly interpolating
steps.pr.outputs.repo using ${{ }} syntax. Instead, set the repository name as
an environment variable in an env section at the step level, then reference that
variable in the bash conditional using standard shell variable syntax
($variable_name) to safely evaluate the condition.

---

Nitpick comments:
In @.github/workflows/rebase.yaml:
- Around line 68-71: The "Install Claude Code" step downloads and executes an
installer script from https://claude.ai/install.sh without verifying its
integrity, creating a supply chain risk if the remote source is compromised.
Either add checksum verification to the curl command by capturing the script
hash and comparing it against a known value before execution, or investigate if
Claude Code provides a pinned version installation method and use that instead.
If accepting this risk is intentional due to convenience trade-offs, add a
comment explaining the accepted risk and why it was chosen despite the security
implications.
🪄 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: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: 779621d1-f840-40f8-a9e5-59c5e597de20

📥 Commits

Reviewing files that changed from the base of the PR and between c35f662 and ff1f5c9.

📒 Files selected for processing (2)
  • .github/workflows/rebase.yaml
  • .github/workflows/restructure-commits.yaml

Comment thread .github/workflows/rebase.yaml
Comment thread .github/workflows/restructure-commits.yaml
@bryan-cox

Copy link
Copy Markdown
Member Author

/area ai

@openshift-ci openshift-ci Bot added area/ai Indicates the PR includes changes related to AI - Claude agents, Cursor rules, etc. and removed do-not-merge/needs-area labels Jun 18, 2026
Add two new GitHub Actions workflows triggered by PR comments:
- /restructure-commits: invokes the repo's restructure-commits
  command via Claude to reorganize branch commits by component
- /rebase: uses Claude to rebase the PR onto latest main, resolve
  any conflicts, and force push

Both follow the same pattern as the address-review-comments workflow
with concurrency grouping, fork token handling, and GCP WIF auth.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (2)
.github/workflows/rebase.yaml (1)

70-73: 💤 Low value

Supply chain risk: piping remote script to bash.

The Claude Code installation fetches and executes an external script without integrity verification. If claude.ai/install.sh is compromised or modified, malicious code would run in CI. Consider pinning to a known-good version or checksum.

🛡️ Proposed fix with checksum verification
      - name: Install Claude Code
        run: |
-         curl -fsSL https://claude.ai/install.sh | bash
+         curl -fsSL https://claude.ai/install.sh -o /tmp/install.sh
+         # TODO: Add checksum verification when Claude publishes checksums
+         # echo "EXPECTED_SHA256  /tmp/install.sh" | sha256sum -c -
+         bash /tmp/install.sh
          echo "$HOME/.local/bin" >> $GITHUB_PATH
🤖 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/rebase.yaml around lines 70 - 73, The Claude Code
installation step in the workflow downloads and executes a remote script without
verifying its integrity, creating a supply chain security risk. Modify the
installation logic to add checksum or signature verification for the downloaded
script before execution, or pin the installation to a specific version tag
rather than piping an unverified remote script directly to bash.

Source: Coding guidelines

.github/workflows/restructure-commits.yaml (1)

95-95: 💤 Low value

Consider reducing --max-turns limit.

The --max-turns 200 is significantly higher than the rebase workflow's limit of 50. While restructuring commits may require more iterations, 200 turns could lead to unexpectedly long/expensive runs or allow more opportunity for unintended behavior. Consider whether a lower limit (e.g., 75-100) would suffice.

🤖 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/restructure-commits.yaml at line 95, The claude command
invocation in the restructure-commits workflow has --max-turns set to 200, which
is significantly higher than the 50 turns limit used in the rebase workflow.
Reduce the --max-turns parameter from 200 to a more reasonable value like 75 or
100 to prevent unexpectedly long and expensive runs while still allowing
sufficient iterations for commit restructuring. This balances the need for
multiple turns with the risk of unintended behavior and excessive resource
consumption.
🤖 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/restructure-commits.yaml:
- Around line 82-95: The Claude invocation in the Restructure commits step uses
the -p "/restructure-commits" flag to load a command file from the checked-out
PR branch, which creates a prompt injection vulnerability since a malicious PR
contributor could modify this file. Instead of referencing an external command
file, inline the actual prompt content directly in the workflow file by removing
the -p "/restructure-commits" parameter and providing the prompt text inline
using Claude's input mechanism (such as via echo piping, heredoc, or input
flags). This ensures only the trusted, hardcoded prompt content is executed
regardless of what the PR contains.

---

Nitpick comments:
In @.github/workflows/rebase.yaml:
- Around line 70-73: The Claude Code installation step in the workflow downloads
and executes a remote script without verifying its integrity, creating a supply
chain security risk. Modify the installation logic to add checksum or signature
verification for the downloaded script before execution, or pin the installation
to a specific version tag rather than piping an unverified remote script
directly to bash.

In @.github/workflows/restructure-commits.yaml:
- Line 95: The claude command invocation in the restructure-commits workflow has
--max-turns set to 200, which is significantly higher than the 50 turns limit
used in the rebase workflow. Reduce the --max-turns parameter from 200 to a more
reasonable value like 75 or 100 to prevent unexpectedly long and expensive runs
while still allowing sufficient iterations for commit restructuring. This
balances the need for multiple turns with the risk of unintended behavior and
excessive resource consumption.
🪄 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: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: b6111972-575b-412f-9b3a-b3875e838d08

📥 Commits

Reviewing files that changed from the base of the PR and between ff1f5c9 and c2daac2.

📒 Files selected for processing (2)
  • .github/workflows/rebase.yaml
  • .github/workflows/restructure-commits.yaml

Comment thread .github/workflows/restructure-commits.yaml
@bryan-cox

Copy link
Copy Markdown
Member Author

/verified later @bryan-cox

Unfortunately, we can't test these until they merge 😞

@openshift-ci-robot openshift-ci-robot added verified-later verified Signifies that the PR passed pre-merge verification criteria labels Jun 18, 2026
@openshift-ci-robot

Copy link
Copy Markdown

@bryan-cox: This PR has been marked to be verified later by @bryan-cox.

Details

In response to this:

/verified later @bryan-cox

Unfortunately, we can't test these until they merge 😞

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@jparrill

Copy link
Copy Markdown
Contributor

/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Jun 18, 2026
@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Pipeline controller notification

No second-stage tests were triggered for this PR.

This can happen when:

  • The changed files don't match any pipeline_run_if_changed patterns
  • All files match pipeline_skip_if_only_changed patterns
  • No pipeline-controlled jobs are defined for the main branch

Use /test ? to see all available tests.

@openshift-ci

openshift-ci Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

@bryan-cox: all tests passed!

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@openshift-merge-bot
openshift-merge-bot Bot merged commit 7f7d696 into openshift:main Jun 18, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. area/ai Indicates the PR includes changes related to AI - Claude agents, Cursor rules, etc. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged. verified Signifies that the PR passed pre-merge verification criteria verified-later

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants