You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 60e903b
Browse filesBrowse the repository at this point in the historyBrowse files
feat: add pr-title input to validate pull request title (#217)
* feat: add pr-title input to validate pull request title
Add a new pr-title input that validates the PR title against the
Conventional Commits specification using commit-check's --message
check. This is especially useful for teams using Squash and Merge,
where the PR title becomes the final commit message.
Key changes:
- action.yml: add pr-title input (default: false)
- main.py: add get_pr_title(), PR_TITLE_ENABLED flag, integrate
PR title validation into run_commit_check()
- main_test.py: add tests for get_pr_title(), PR title in
run_commit_check(), and initial_emitted parameter
Closes#93
* chore: auto fixes from pre-commit.com hooks
* docs: add pr-title input documentation to README
* docs: remove 'experimental' label from pr-comments
The pr-comments feature has been stable for 8+ months with proper
fork PR handling, pull_request_target support, and comprehensive
error handling. The 'experimental' label is no longer accurate.
* chore: enable pr-title check in self-test pipeline
* fix: listen pull_request edited event so pr-title validates on title change
The pull_request event does not include the 'edited' type by default,
so changing the PR title never re-triggers the workflow. Adding
'edited' ensures the pr-title check runs immediately when the title
is updated, giving the contributor instant feedback.
* docs: add event type guidance for pr-title validation
Explain that pull_request does not trigger on title edits by default,
and show how to add the 'edited' type to enable immediate validation.
* fix: add clear label to PR title check output
- Print '--- PR title check ---' in the log so users can distinguish
PR title validation from individual commit message checks
- Always set output_prefix for result.txt so the failure output clearly
identifies which check failed
* fix: use consistent separator style for PR title output
Remove the markdown-style '# PR Title Validation' heading from
result.txt. When the PR title check fails after other failures,
use '--- PR Title ---' to match the existing commit check separator
style (e.g. '--- Commit 2/6:').
* refactor: remove noisy command logging from action output
Remove the 'commit-check --message' command lines that were being
printed to the action log for every check invocation. The results
are already visible in the job summary and PR comments — the
command echo was debug cruft that created noise, especially when
checking many individual commits in a PR.
* refactor: use ::debug:: workflow command for env var logging
Convert log_env_vars() to use ::debug:: workflow commands so the
environment variable values only appear in the action log when
ACTIONS_STEP_DEBUG is enabled. This follows GitHub Actions best
practices for diagnostic output.
* chore: auto fixes from pre-commit.com hooks
* refactor: clean up run_commit_check by removing dead code path
The PR title check always runs first, so the 'if emitted_failure_output'
branch inside it was unreachable. Remove it to reduce nesting and
improve readability.
* chore: auto fixes from pre-commit.com hooks
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Copy file name to clipboardExpand all lines: README.md
+30-2Lines changed: 30 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -121,8 +121,8 @@ jobs:
121
121
- **Description**: post results to the pull request comments.
122
122
- Default: `false`
123
123
124
-
> [!IMPORTANT]
125
-
> `pr-comments` is an experimental feature. By default, it's disabled.
124
+
> [!NOTE]
125
+
> `pr-comments` is disabled by default.
126
126
>
127
127
> PR comments are skipped for pull requests from forked repositories. See
128
128
> [docs/fork-pr-comments.md](docs/fork-pr-comments.md) for details on how to enable
@@ -131,6 +131,34 @@ jobs:
131
131
> Note: write-access to pull-requests requires the `pull-requests: write` permission.
132
132
> See [usage example](#usage).
133
133
134
+
### `pr-title`
135
+
136
+
- **Description**: check pull request title following [Conventional Commits](https://www.conventionalcommits.org/).
137
+
- Default: `false`
138
+
139
+
> [!TIP]
140
+
> This is especially useful for teams using **Squash & Merge**, where the PR title
141
+
> becomes the final commit message in the main branch. When enabled, the action
142
+
> validates the PR title against your Conventional Commits configuration, giving
143
+
> early feedback at PR time rather than after merge.
144
+
>
145
+
> `pr-title` works alongside `message` — you can enable both to validate the PR
146
+
> title and individual commits, or just one depending on your workflow.
147
+
>
148
+
> This setting only applies to `pull_request` and `pull_request_target` events;
149
+
> it is silently ignored on `push` events.
150
+
151
+
> [!IMPORTANT]
152
+
> By default, `pull_request` does **not** trigger on title changes.
153
+
> To validate the PR title immediately when updated, add `edited` to your
154
+
> workflow's event types:
155
+
> ```yaml
156
+
> on:
157
+
> pull_request:
158
+
> types: [opened, synchronize, reopened, edited]
159
+
> ```
160
+
> Without `edited`, only the initial title (at PR creation) is validated.
161
+
134
162
Note: the default rule of above inputs is following [this configuration](https://github.com/commit-check/commit-check-action/blob/main/commit-check.toml). If you want to customize, just add your [`commit-check.toml`](https://commit-check.github.io/commit-check/configuration.html) config file under your repository root directory.
0 commit comments