Add a gitlint check in CI - #4063
Conversation
Signed-off-by: mulhern <amulhern@redhat.com>
|
Congratulations! One of the builds has completed. 🍾 You can install the built RPMs by following these steps:
Please note that the RPMs should be used only in a testing environment. |
6043ecd to
901a247
Compare
|
It works! |
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (3)
WalkthroughChangesCommit linting
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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/main.yml:
- Around line 368-382: Update the gitlint step in the commit-checks job to
select an event-specific revision range: use github.event.before..github.sha for
push events and retain origin/${{ github.base_ref }}..HEAD for pull_request
events. Ensure the workflow never constructs an invalid origin/..HEAD range.
🪄 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: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: c0ab95b0-6df0-4d2d-9a04-b53d947ac6fc
📒 Files selected for processing (3)
.github/workflows/main.yml.gitlintCargo.toml
| commit-checks: | ||
| runs-on: ubuntu-24.04 | ||
| container: | ||
| image: fedora:43 # CURRENT DEVELOPMENT ENVIRONMENT | ||
| steps: | ||
| - name: Install dependencies | ||
| run: dnf install -y git gitlint | ||
| - uses: actions/checkout@v6 | ||
| with: | ||
| fetch-depth: 0 | ||
| persist-credentials: false | ||
| - name: allow gitlint to process commits | ||
| run: git config --global --add safe.directory "$GITHUB_WORKSPACE" | ||
| - name: gitlint | ||
| run: gitlint --commits origin/${{ github.base_ref }}..HEAD |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
rg -n -C 5 'commit-checks|github\.base_ref|github\.event\.before|gitlint --commits' \
.github/workflows/main.ymlRepository: stratis-storage/stratisd
Length of output: 838
🏁 Script executed:
#!/bin/bash
set -euo pipefail
sed -n '1,80p' .github/workflows/main.yml
printf '\n--- commit-checks job ---\n'
sed -n '360,390p' .github/workflows/main.ymlRepository: stratis-storage/stratisd
Length of output: 3076
Use an event-specific revision range for gitlint.
The workflow runs on push and pull_request, but github.base_ref is only set for pull requests. On push, gitlint --commits origin/..HEAD is invalid. Use the push ranges for push events, for example github.event.before..github.sha, and preserve the pull-request range only there.
🧰 Tools
🪛 zizmor (1.29.0)
[warning] 368-383: overly broad permissions (excessive-permissions): default permissions used due to no permissions: block
(excessive-permissions)
[error] 382-382: 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/main.yml around lines 368 - 382, Update the gitlint step
in the commit-checks job to select an event-specific revision range: use
github.event.before..github.sha for push events and retain origin/${{
github.base_ref }}..HEAD for pull_request events. Ensure the workflow never
constructs an invalid origin/..HEAD range.
Source: Linters/SAST tools
There was a problem hiding this comment.
@coderabbitai Give me a range that works for both, even if for push it's an empty range.
There was a problem hiding this comment.
@mulkieran, use this range:
run: gitlint --commits "${{ github.event.pull_request.base.sha || github.sha }}..${{ github.sha }}"For pull_request, it checks from the pull request base SHA to github.sha.
For push, it evaluates to github.sha..github.sha. This is an empty range and is valid.
You are interacting with an AI system.
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
647f0dd to
9f40870
Compare
Only run the commit checks on a pull request. Once it is merged, it is merged; there is not really any point in checking afterward if the spelling or formatting was correct. Signed-off-by: mulhern <amulhern@redhat.com>
|
This ought to be abstracted into a composite action and used in all our repos, or at least the Rust ones that are already set up to use typos-cli. |
Summary by CodeRabbit