Skip to content

Add a gitlint check in CI - #4063

Draft
mulkieran wants to merge 2 commits into
stratis-storage:masterfrom
mulkieran:add-gitlint
Draft

Add a gitlint check in CI#4063
mulkieran wants to merge 2 commits into
stratis-storage:masterfrom
mulkieran:add-gitlint

Conversation

@mulkieran

@mulkieran mulkieran commented Aug 4, 2026

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • Chores
    • Added automated commit message checks to the pull request workflow.
    • Configured commit validation to allow messages without a body.
    • Excluded commit-check configuration from packaged files.

Signed-off-by: mulhern <amulhern@redhat.com>
@packit-as-a-service

Copy link
Copy Markdown

Congratulations! One of the builds has completed. 🍾

You can install the built RPMs by following these steps:

  • sudo dnf install -y 'dnf*-command(copr)'
  • dnf copr enable packit/stratis-storage-stratisd-4063-copr_pull
  • And now you can install the packages.

Please note that the RPMs should be used only in a testing environment.

@mulkieran
mulkieran force-pushed the add-gitlint branch 5 times, most recently from 6043ecd to 901a247 Compare August 4, 2026 20:22
@mulkieran mulkieran moved this to In Progress in 2026August Aug 4, 2026
@mulkieran

Copy link
Copy Markdown
Member Author

It works!

@mulkieran
mulkieran requested a review from jbaublitz August 4, 2026 21:19
@mulkieran mulkieran moved this from In Progress to In Review in 2026August Aug 4, 2026
@mulkieran

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: b1a42b92-de01-4535-9b12-3d8eda36f638

📥 Commits

Reviewing files that changed from the base of the PR and between 0d31f67 and ac83d67.

📒 Files selected for processing (3)
  • .github/workflows/main.yml
  • .gitlint
  • Cargo.toml
🚧 Files skipped from review as they are similar to previous changes (3)
  • Cargo.toml
  • .gitlint
  • .github/workflows/main.yml

Walkthrough

Changes

Commit linting

Layer / File(s) Summary
Configure Gitlint files
.gitlint, Cargo.toml
Gitlint excludes the body-is-missing rule. Cargo excludes /.gitlint from the package file list.
Run commit linting
.github/workflows/main.yml
GitHub Actions adds a commit-checks job. It installs Git and gitlint, checks out full history, marks the workspace safe, and validates commits from the pull request base branch to HEAD.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 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 clearly and concisely describes the primary change: adding a gitlint check to CI.
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

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.

❤️ Share

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

📥 Commits

Reviewing files that changed from the base of the PR and between 0d31f67 and 8d82ad1.

📒 Files selected for processing (3)
  • .github/workflows/main.yml
  • .gitlint
  • Cargo.toml

Comment thread .github/workflows/main.yml Outdated
Comment on lines +368 to +382
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

@coderabbitai coderabbitai Bot Aug 5, 2026

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

🧩 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.yml

Repository: 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.yml

Repository: 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

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@coderabbitai Give me a range that works for both, even if for push it's an empty range.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@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.

@mulkieran
mulkieran removed the request for review from jbaublitz August 5, 2026 02:19
@mulkieran mulkieran moved this from In Review to In Progress in 2026August Aug 5, 2026
@mulkieran
mulkieran marked this pull request as draft August 5, 2026 02:20
@mulkieran

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown

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.

@mulkieran
mulkieran force-pushed the add-gitlint branch 2 times, most recently from 647f0dd to 9f40870 Compare August 5, 2026 13:33
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>
@mulkieran

Copy link
Copy Markdown
Member Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

1 participant