Skip to content

Conversation

@2bndy5
Copy link
Contributor

@2bndy5 2bndy5 commented Sep 8, 2025

This should remove some confusion about checking a changed PR title

Summary by CodeRabbit

  • Chores
    • Standardized PR title retrieval and propagation across validation checks to ensure consistent validation input.
    • Switched pipeline steps to a consistent shell environment for more reliable title processing.
    • Centralized configuration for commit-message and spell-check validations.
    • Minor workflow formatting cleanups.
    • No user-facing changes; internal CI reliability and consistency improvements.

This should remove some confusion about checking a changed PR title
@2bndy5 2bndy5 added the enhancement New feature or request label Sep 8, 2025
@2bndy5 2bndy5 marked this pull request as draft September 8, 2025 11:08
@cpp-linter cpp-linter deleted a comment from coderabbitai bot Sep 8, 2025
@coderabbitai
Copy link

coderabbitai bot commented Sep 8, 2025

Walkthrough

Adds a Get PR title step (using gh pr view) to the check-pr-title job and exposes the title via steps.get-title.outputs.title; updates conventional-commit and spell check steps to consume that output (piping it into their CLIs) and introduces a COMMITTED_CONFIG env variable; minor YAML/quoting formatting tweaks.

Changes

Cohort / File(s) Summary
GitHub Actions workflow update
.github/workflows/pre-commit.yml
Add Get PR title step that runs gh pr view and writes steps.get-title.outputs.title; switch conventional-commit and spell check steps to read PR_TITLE from steps.get-title.outputs.title and pipe that title into committed and npx cspell-cli respectively (run under the default shell); introduce COMMITTED_CONFIG env usage; minor YAML quoting/formatting adjustments.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant Runner as GitHub Actions Runner
  participant Shell as Default shell
  participant GHCLI as gh CLI
  participant API as GitHub API
  participant Committed as committed CLI
  participant CSpell as npx cspell-cli

  rect rgba(200,230,255,0.25)
    Note over Runner: Job: check-pr-title
  end

  Runner->>Shell: steps.get-title -> gh pr view <pr_number> --json title
  Shell->>GHCLI: request PR title
  GHCLI->>API: GitHub API request
  API-->>GHCLI: PR title
  GHCLI-->>Shell: outputs.title set

  rect rgba(220,255,220,0.25)
    Note over Runner: Subsequent steps consume steps.get-title.outputs.title
  end

  Runner->>Shell: conventional-commit step reads PR_TITLE and COMMITTED_CONFIG
  Shell->>Committed: pipe "$PR_TITLE" into committed --config "$COMMITTED_CONFIG"

  Runner->>Shell: spell check step reads PR_TITLE
  Shell->>CSpell: echo "$PR_TITLE" | npx cspell-cli lint --stdin
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes


📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2a336e6 and 62d6225.

📒 Files selected for processing (1)
  • .github/workflows/pre-commit.yml (5 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/pre-commit.yml
✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch dyn-pr-title

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 and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (1)
.github/workflows/pre-commit.yml (1)

31-31: Prefer explicit $HOME over quoted ~ in cache path.

Quoting may prevent tilde expansion by the cache action. Use ${{ env.HOME }} for portability.

Apply:

-          path: "~/.cache/pre-commit"
+          path: ${{ env.HOME }}/.cache/pre-commit
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3347398 and f1688cb.

📒 Files selected for processing (1)
  • .github/workflows/pre-commit.yml (5 hunks)
🧰 Additional context used
🪛 actionlint (1.7.7)
.github/workflows/pre-commit.yml

68-68: receiver of object dereference "pr_number" must be type of object but got "string"

(expression)

🔇 Additional comments (3)
.github/workflows/pre-commit.yml (3)

58-62: Verify fallback operator support in expressions.

Confirm that ${{ vars.NUSHELL_VERSION || '*' }} is valid in your org runners. If not, prefer a conditional expression or default via env.

Example fallback:

-          version: ${{ vars.NUSHELL_VERSION || '*' }}
+          version: ${{ vars.NUSHELL_VERSION != '' && vars.NUSHELL_VERSION || '*' }}

85-88: Confirm committed’s stdin usage.

Ensure committed supports --commit-file - with stdin (some versions require a real file).

If needed:

-        run: $env.PR_TITLE | ^committed --config $env.COMMITTED_CONFIG --commit-file -
+        run: $"($env.PR_TITLE)" | save pr_title.txt; ^committed --config $env.COMMITTED_CONFIG --commit-file pr_title.txt

22-22: LGTM on Python version matrix.

Using "3.x" keeps runners up-to-date across 3.x releases.

@2bndy5 2bndy5 changed the title fix: get PR title dynamically bad title: get PR title dynamically Sep 8, 2025
@2bndy5 2bndy5 changed the title bad title: get PR title dynamically fix: get PR title dynamically Sep 8, 2025
@2bndy5 2bndy5 marked this pull request as ready for review September 8, 2025 11:24
@2bndy5
Copy link
Contributor Author

2bndy5 commented Sep 8, 2025

@shenxianpeng This will allow re-running the "Check PR title" job when the PR title has changed without any new CI event trigger. 😉

@2bndy5
Copy link
Contributor Author

2bndy5 commented Sep 8, 2025

@coderabbitai full review

@coderabbitai
Copy link

coderabbitai bot commented Sep 8, 2025

✅ Actions performed

Full review triggered.

@2bndy5 2bndy5 merged commit be33864 into main Sep 8, 2025
5 checks passed
@2bndy5 2bndy5 deleted the dyn-pr-title branch September 8, 2025 12:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants