OCPBUGS-85084: fix(ci): rewrite dependabot commit messages to pass gitlint#8435
Conversation
|
Pipeline controller notification For optional jobs, comment This repository is configured in: LGTM mode |
|
@jparrill: This pull request references Jira Issue OCPBUGS-85084, which is invalid:
Comment The bug has been updated to refer to the pull request using the external bug tracker. DetailsIn response to this:
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. |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughA new reusable GitHub Actions workflow ("Fix Dependabot Commit Messages") and a wrapper workflow that triggers it were added. The wrapper listens for completed Sequence Diagram(s)sequenceDiagram
participant DependabotWorkflow as Dependabot Workflow
participant Wrapper as Fix Dependabot Commit Messages (trigger)
participant Reusable as Fix Dependabot Commit Messages (reusable)
participant Runner as Actions Runner
participant GitRepo as Git Repository
DependabotWorkflow->>Wrapper: workflow_run (completed, failed)
Wrapper->>Reusable: workflow_call (head_sha, head_branch)
Reusable->>Runner: start job "fix-commit-message"
Runner->>GitRepo: actions/checkout (fetch refs)
Runner->>Runner: read last commit subject and body
Runner->>Runner: parse dependency-update lines or wrap body
Runner->>Runner: preserve Signed-off-by if present
Runner->>GitRepo: git commit --amend (update message)
Runner->>GitRepo: git push --force-with-lease
🚥 Pre-merge checks | ✅ 12✅ Passed checks (12 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Comment |
|
/cc @bryan-cox PTAL :) |
There was a problem hiding this comment.
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/dependabot-commit-fix.yaml:
- Around line 48-50: The current multiline quoted assignment to NEW_BODY inside
the loop (using variables UPDATES, short, source, target) injects an embedded
newline that breaks YAML parsing; change the append to build the string without
splitting a quoted literal across lines — e.g., append a single-line formatted
entry (including a terminating newline) to NEW_BODY using a safe one-line method
such as printf -v or NEW_BODY+= with an explicit "\n" so the loop that reads
UPDATES produces properly escaped single-line YAML content.
- Around line 23-24: Replace the checkout ref that uses
github.event.workflow_run.head_branch with the exact commit SHA
github.event.workflow_run.head_sha in the checkout step (the line currently
showing "ref: ${{ github.event.workflow_run.head_branch }}") so the action
checks out the precise commit that triggered the workflow; also update the push
command used later in the job to explicitly target the branch ref (i.e., include
the branch name/ref in the git push) so the force-push amends the intended ref
rather than pushing to an ambiguous head.
🪄 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: d0a78fca-a800-42ec-b497-d2d4ec720292
📒 Files selected for processing (1)
.github/workflows/dependabot-commit-fix.yaml
|
/area ci-tooling |
|
/jira refresh |
|
@jparrill: This pull request references Jira Issue OCPBUGS-85084, which is valid. The bug has been moved to the POST state. 3 validation(s) were run on this bug
DetailsIn response to this:
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. |
There was a problem hiding this comment.
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/dependabot-commit-fix.yaml:
- Around line 38-43: The fallback wrapping path currently folds the full BODY
into WRAPPED and sets NEW_BODY="$WRAPPED", which causes duplicated
"Signed-off-by:" trailers because the later block appends the first
Signed-off-by again; update the logic to detect and extract any trailing
"Signed-off-by:" line(s) from BODY into a separate TRAILER variable (or
FIRST_SIGNED_OFF), remove those lines from BODY before running fold into
WRAPPED, set NEW_BODY="$WRAPPED" and then append the preserved TRAILER exactly
once; reference the existing variables WRAPPED, BODY, NEW_BODY and the block
that appends the first "Signed-off-by:" to implement this change.
- Around line 33-34: The UPDATES extraction pipeline can fail if grep returns
non-zero; replace the two-step grep+sed pipeline used to populate the UPDATES
variable with a single non-failing sed extraction that reads from BODY (e.g.,
use sed -nE with the same regex and print only matches) so that UPDATES is set
to an empty string when there are no "Updates `...`" lines; update the
assignment that sets UPDATES to run only this sed command (refer to the UPDATES
variable and the current grep+sed pipeline) to make the extraction non-fatal.
🪄 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: ecbaecfc-7819-47e1-97fb-fde9da44b8b0
📒 Files selected for processing (1)
.github/workflows/dependabot-commit-fix.yaml
|
@jparrill: This pull request references Jira Issue OCPBUGS-85084, which is valid. 3 validation(s) were run on this bug
DetailsIn response to this:
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. |
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/dependabot-commit-fix.yaml:
- Around line 49-53: The generated bullet lines inside the while loop that
builds NEW_BODY (the "- ${short}: ${source} => ${target}" template) can exceed
140 chars; update the loop that reads UPDATES to wrap each generated bullet to
140 columns before appending to NEW_BODY (e.g., produce the single bullet string
then run it through a line-wrapping command like fold/fmt with -w 140 and -s,
preserving the leading "- " indent on wrapped lines) so that every appended
chunk respects the 140-char gitlint rule.
🪄 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: b2f37bac-d60a-488f-9a8f-9c718690ab57
📒 Files selected for processing (1)
.github/workflows/dependabot-commit-fix.yaml
Local testingVerified parsing + gitlint compliance against real dependabot commit messages. Test 1: Single dependency (PR #8392) — PASS ✅Before (dependabot auto-generated):
After (workflow rewrite):
Test 2: Multi-dependency (4 Azure SDK deps) — PASS ✅Before: 476-char line with 4 full GitHub URLs on one line → After (workflow rewrite):
Test 3: Fallback path (no Updates lines, fold wrapping) — PASS ✅Before: 170-char body line → YAML validation: |
There was a problem hiding this comment.
♻️ Duplicate comments (1)
.github/workflows/dependabot-commit-fix.yaml (1)
49-53:⚠️ Potential issue | 🟠 Major | ⚡ Quick winWrap generated dependency bullets before composing
NEW_BODY.Line 51 appends raw bullet lines; long
source/targetvalues can still exceed 140 chars and keep gitlint failing.Suggested fix
else NEW_BODY="" while IFS='|' read -r lib source target; do short=$(basename "$lib") - NEW_BODY+="- ${short}: ${source} => ${target}"$'\n' + bullet="- ${short}: ${source} => ${target}" + wrapped=$(printf '%s\n' "$bullet" | fold -w 140 | sed '2,$s/^/ /') + NEW_BODY+="${wrapped}"$'\n' done <<< "$UPDATES" fi🤖 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/dependabot-commit-fix.yaml around lines 49 - 53, The loop that builds NEW_BODY from UPDATES (while IFS='|' read -r lib source target; short=$(basename "$lib")) currently appends raw bullet lines which can exceed 140 chars; instead wrap each generated bullet to 140 chars before concatenation (e.g., build the bullet string "- ${short}: ${source} => ${target}", pipe it through a wrapping utility like fold or fmt with -w 140 -s, and prefix wrapped continuation lines with spaces to preserve bullet formatting) and then append the wrapped result to NEW_BODY so long source/target values won't trigger gitlint failures.
🤖 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.
Duplicate comments:
In @.github/workflows/dependabot-commit-fix.yaml:
- Around line 49-53: The loop that builds NEW_BODY from UPDATES (while IFS='|'
read -r lib source target; short=$(basename "$lib")) currently appends raw
bullet lines which can exceed 140 chars; instead wrap each generated bullet to
140 chars before concatenation (e.g., build the bullet string "- ${short}:
${source} => ${target}", pipe it through a wrapping utility like fold or fmt
with -w 140 -s, and prefix wrapped continuation lines with spaces to preserve
bullet formatting) and then append the wrapped result to NEW_BODY so long
source/target values won't trigger gitlint failures.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository YAML (base), Central YAML (inherited)
Review profile: CHILL
Plan: Enterprise
Run ID: 8542894b-5433-4ec8-8d5f-36d103e0a293
📒 Files selected for processing (1)
.github/workflows/dependabot-commit-fix.yaml
Dependabot auto-generates commit body lines with URLs that exceed the body-max-line-length=140 limit in .gitlint. This is not configurable in dependabot (dependabot-core#2445). Add a workflow that triggers via workflow_run after Gitlint fails for dependabot PRs. It parses the commit body, extracts library names and version ranges, and reconstructs a clean message that passes gitlint validation. Closes: OCPBUGS-85084 Commit-Message-Assisted-by: Claude (via Claude Code) Signed-off-by: Juan Manuel Parrilla Madrid <jparrill@redhat.com>
|
Pipeline controller notification No second-stage tests were triggered for this PR. This can happen when:
Use |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: bryan-cox, jparrill The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/verified later @jparrill |
|
@bryan-cox: This PR has been marked to be verified later by DetailsIn response to this:
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: all tests passed! Full PR test history. Your PR dashboard. DetailsInstructions 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. |
|
@jparrill: Jira Issue OCPBUGS-85084: All pull requests linked via external trackers have merged: This pull request has the DetailsIn response to this:
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. |
Summary
workflow_runafter the Gitlint check fails for dependabot PRsbody-max-line-length=140@mainworkflow pattern for consistency and securityRelated: OCPBUGS-85084 | dependabot-core#2445
Structure
dependabot-commit-fix.yamlworkflow_run(Gitlint failure + dependabot actor), delegates to reusable@maindependabot-commit-fix-reusable.yamlhead_shaandhead_branchas inputs, rewrites the commit body and pushesFlow
dependabot-commit-fix.yamltriggers → calls reusable workflowhead_sha), parsesUpdateslines, reconstructs clean bodyExample
Current dependabot commit (fails gitlint, 476 chars on one line):
After this workflow rewrites it:
cc @bryan-cox
Test plan
🤖 Generated with Claude Code