Skip to content

Commit e35dcc7

Browse files
committed
feat: name the PR description input pr-body-ai-attribution
pr-body read like pr-title, which checks the title against every message rule, while this input checks the description against the AI attribution rules only. pr-body-ai-attribution names both the subject and what is checked, the same words as ai_attribution in cchk.toml and the CLI's --ai-attribution-only. The input has not been released yet.
1 parent 677d3b0 commit e35dcc7

4 files changed

Lines changed: 12 additions & 12 deletions

File tree

‎README.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,15 +79,15 @@ runners need a few tools — see [Good to know](#good-to-know).
7979
| `author-name` | `false` | Check each commit's author name |
8080
| `author-email` | `false` | Check each commit's author email |
8181
| `pr-title` | `false` | Check the pull request title against Conventional Commits — the one that matters for squash merges. Pull request events only |
82-
| `pr-body` | `false` | Check the pull request description against the AI rules of `cchk.toml` (`ai_attribution`) only. Pull request events only |
82+
| `pr-body-ai-attribution` | `false` | Check the pull request description against the AI rules of `cchk.toml` (`ai_attribution`) only. Pull request events only |
8383
| `ai-label` | `false` | Label the pull request when an AI tool wrote any of it (a commit, the description, or an agent's app that opened it): `true` for `ai-assisted`, or the label's name. Labels are only added, never removed. Needs `pull-requests: write`; skipped on fork pull requests under `pull_request` |
8484
| `pr-comments` | `false` | Post the report as a pull request comment, edited in place on later runs. Needs `pull-requests: write`; skipped on fork pull requests |
8585
| `job-summary` | `true` | Write the report to the job summary |
8686
| `dry-run` | `false` | Report failures as warnings and always exit 0 |
8787

8888
> [!TIP]
8989
> `pull_request` does not fire when a title or description is edited. With
90-
> `pr-title` or `pr-body`, add `types: [opened, synchronize, reopened, edited]`
90+
> `pr-title` or `pr-body-ai-attribution`, add `types: [opened, synchronize, reopened, edited]`
9191
> to re-check an edited pull request.
9292

9393
## Configuration

‎action.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ inputs:
3737
description: check pull request title following conventional commits
3838
required: false
3939
default: false
40-
pr-body:
40+
pr-body-ai-attribution:
4141
description: check the pull request description against the AI attribution rules (ai_attribution in cchk.toml)
4242
required: false
4343
default: false
@@ -118,6 +118,6 @@ runs:
118118
JOB_SUMMARY: ${{ inputs.job-summary }}
119119
PR_COMMENTS: ${{ inputs.pr-comments }}
120120
PR_TITLE: ${{ inputs.pr-title }}
121-
PR_BODY: ${{ inputs.pr-body }}
121+
PR_BODY_AI_ATTRIBUTION: ${{ inputs.pr-body-ai-attribution }}
122122
AI_LABEL: ${{ inputs.ai-label }}
123123
GITHUB_TOKEN: ${{ github.token }}

‎main.py‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def _reconfigure_io() -> None:
8787
JOB_SUMMARY_ENABLED = env_flag("JOB_SUMMARY")
8888
PR_COMMENTS_ENABLED = env_flag("PR_COMMENTS")
8989
PR_TITLE_ENABLED = env_flag("PR_TITLE")
90-
PR_BODY_ENABLED = env_flag("PR_BODY")
90+
PR_BODY_AI_ATTRIBUTION_ENABLED = env_flag("PR_BODY_AI_ATTRIBUTION")
9191

9292
#: The label ``ai-label: true`` puts on a pull request that an AI tool wrote.
9393
DEFAULT_AI_LABEL = "ai-assisted"
@@ -254,7 +254,7 @@ def log_env_vars():
254254
"JOB_SUMMARY",
255255
"PR_COMMENTS",
256256
"PR_TITLE",
257-
"PR_BODY",
257+
"PR_BODY_AI_ATTRIBUTION",
258258
"AI_LABEL",
259259
):
260260
value = os.getenv(name, "false")
@@ -464,7 +464,7 @@ def get_pr_opener_tool() -> str | None:
464464

465465

466466
#: The AI tools found in the pull request description when it was read for
467-
#: the label only (``ai-label`` without ``pr-body``), so it is no scope.
467+
#: the label only (``ai-label`` without ``pr-body-ai-attribution``), so it is no scope.
468468
PR_BODY_AI_TOOLS: list[str] = []
469469

470470

@@ -789,7 +789,7 @@ def run_commit_check() -> tuple[int, list[ScopeResult]]:
789789
790790
Checks are evaluated in order:
791791
1. PR title (when ``pr-title: true`` and in a PR event)
792-
2. PR description, AI rules only (when ``pr-body: true`` and in a PR
792+
2. PR description, AI rules only (when ``pr-body-ai-attribution: true`` and in a PR
793793
event; with only ``ai-label`` set it is read for the label, and no
794794
scope is reported)
795795
3. Individual PR commit messages (when ``message: true`` and in a PR event)
@@ -807,13 +807,13 @@ def run_commit_check() -> tuple[int, list[ScopeResult]]:
807807
results.append(check_scope("PR title", ["--message"], input_text=pr_title))
808808

809809
# ---- 2. PR description ------------------------------------------------
810-
if (PR_BODY_ENABLED or ai_label_name()) and is_pr_event():
810+
if (PR_BODY_AI_ATTRIBUTION_ENABLED or ai_label_name()) and is_pr_event():
811811
pr_body = get_pr_body()
812812
if pr_body:
813813
scope = check_scope(
814814
"PR description", ["--ai-attribution-only"], input_text=pr_body
815815
)
816-
if PR_BODY_ENABLED:
816+
if PR_BODY_AI_ATTRIBUTION_ENABLED:
817817
results.append(scope)
818818
else:
819819
PR_BODY_AI_TOOLS[:] = scope.ai_tools

‎main_test.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ def test_every_input_is_logged_as_a_debug_command(self):
153153
"::debug::JOB_SUMMARY=false",
154154
"::debug::PR_COMMENTS=false",
155155
"::debug::PR_TITLE=false",
156-
"::debug::PR_BODY=false",
156+
"::debug::PR_BODY_AI_ATTRIBUTION=false",
157157
"::debug::AI_LABEL=false",
158158
],
159159
)
@@ -3699,7 +3699,7 @@ def _run(self, pr_body_enabled, ai_label, body="Adds a parser."):
36993699
)
37003700
with (
37013701
patch("main.PR_TITLE_ENABLED", False),
3702-
patch("main.PR_BODY_ENABLED", pr_body_enabled),
3702+
patch("main.PR_BODY_AI_ATTRIBUTION_ENABLED", pr_body_enabled),
37033703
patch.dict(os.environ, {"AI_LABEL": ai_label}),
37043704
patch("main.MESSAGE_ENABLED", False),
37053705
patch("main.BRANCH_ENABLED", False),

0 commit comments

Comments
 (0)