Skip to content

Commit c9ddb13

Browse files
committed
fix: address Copilot review round 6 findings
- Remove hardcoded --assignee mnriem from gh pr create; rely on CODEOWNERS for review routing - Remove --table-target README.md from extension workflow since the catalog JSON lacks category/effect fields needed by the README table - Relax 200-char description limit for updates (warn instead of block) so existing long-description entries can be updated - Validate speckit_version with packaging.specifiers.SpecifierSet for full PEP 440 compliance; fall back to regex if packaging unavailable - Split PAT usage in catalog-validate.yml: use default GITHUB_TOKEN for comment read/write, RELEASE_PAT only for label mutation step
1 parent f6b5341 commit c9ddb13

3 files changed

Lines changed: 43 additions & 20 deletions

File tree

.github/scripts/catalog-validate.py

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -213,11 +213,16 @@ def validate_version(
213213
return True, f"Version `{value}` is valid."
214214

215215

216-
def validate_description(value: str) -> tuple[bool, str]:
216+
def validate_description(value: str, *, is_update: bool = False) -> tuple[bool, str]:
217217
if not _present(value):
218218
return False, "Description is required."
219219
value = value.strip()
220220
if len(value) > 200:
221+
if is_update:
222+
return True, (
223+
f"Description is {len(value)} characters (over 200). "
224+
"Consider shortening it in a future update."
225+
)
221226
return False, (
222227
f"Description is {len(value)} characters — please keep it under 200."
223228
)
@@ -327,11 +332,21 @@ def validate_speckit_version(value: str) -> tuple[bool, str]:
327332
if not _present(value):
328333
return False, "Required Spec Kit Version is required."
329334
value = value.strip()
330-
if not _VERSION_CONSTRAINT_RE.match(value):
335+
try:
336+
from packaging.specifiers import InvalidSpecifier, SpecifierSet
337+
SpecifierSet(value)
338+
except InvalidSpecifier as exc:
331339
return False, (
332-
f"Spec Kit version constraint `{value}` looks invalid. "
340+
f"Spec Kit version constraint `{value}` is invalid: {exc}. "
333341
"Use a PEP 440 constraint like `>=0.6.0`."
334342
)
343+
except ImportError:
344+
# Fallback if packaging is not available
345+
if not _VERSION_CONSTRAINT_RE.match(value):
346+
return False, (
347+
f"Spec Kit version constraint `{value}` looks invalid. "
348+
"Use a PEP 440 constraint like `>=0.6.0`."
349+
)
335350
return True, f"Version constraint `{value}` is valid."
336351

337352

@@ -453,7 +468,7 @@ def _add(field: str, ok: bool, msg: str, *, severity: str = "error") -> None:
453468
_add("Version", ok, msg)
454469

455470
# --- Common fields ---
456-
ok, msg = validate_description(fields.get("description", ""))
471+
ok, msg = validate_description(fields.get("description", ""), is_update=is_update)
457472
_add("Description", ok, msg)
458473

459474
ok, msg = validate_required_text(fields.get("author", ""), "Author")

.github/workflows/catalog-pr.yml

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,12 @@ jobs:
3737
--catalog extensions/catalog.community.json \
3838
--type extension
3939
40-
- name: Update catalog and regenerate table
40+
- name: Update catalog
4141
id: update
4242
run: |
4343
python .github/scripts/catalog-pr.py \
4444
--catalog extensions/catalog.community.json \
45-
--type extension \
46-
--table-target README.md
45+
--type extension
4746
4847
- name: Create or update pull request
4948
if: steps.update.outputs.skipped != 'true'
@@ -69,8 +68,7 @@ jobs:
6968
--type extension
7069
python .github/scripts/catalog-pr.py \
7170
--catalog extensions/catalog.community.json \
72-
--type extension \
73-
--table-target README.md
71+
--type extension
7472
else
7573
git checkout -b "$BRANCH"
7674
fi
@@ -79,7 +77,7 @@ jobs:
7977
git config user.name "github-actions[bot]"
8078
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
8179
82-
git add extensions/catalog.community.json README.md
80+
git add extensions/catalog.community.json
8381
git commit -m "${ACTION} community extension: ${ITEM_ID}
8482
8583
Automated from issue #${ISSUE_NUMBER}.
@@ -121,8 +119,7 @@ jobs:
121119
--title "${ACTION} community extension: ${ITEM_ID}" \
122120
--body "$PR_BODY" \
123121
--head "$BRANCH" \
124-
--base main \
125-
--assignee mnriem
122+
--base main
126123
127124
NEW_PR=$(gh pr list --head "$BRANCH" --json number --jq '.[0].number')
128125
gh issue comment "$ISSUE_NUMBER" \
@@ -241,8 +238,7 @@ jobs:
241238
--title "${ACTION} community preset: ${ITEM_ID}" \
242239
--body "$PR_BODY" \
243240
--head "$BRANCH" \
244-
--base main \
245-
--assignee mnriem
241+
--base main
246242
247243
NEW_PR=$(gh pr list --head "$BRANCH" --json number --jq '.[0].number')
248244
gh issue comment "$ISSUE_NUMBER" \

.github/workflows/catalog-validate.yml

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,12 @@ jobs:
3333
--catalog extensions/catalog.community.json \
3434
--type extension
3535
36-
- name: Post validation comment and update labels
36+
- name: Post validation comment
3737
uses: actions/github-script@v7
3838
with:
39-
github-token: ${{ secrets.RELEASE_PAT }}
4039
script: |
4140
const fs = require('fs');
4241
const report = fs.readFileSync('/tmp/validation-report.md', 'utf8');
43-
const result = JSON.parse(fs.readFileSync('/tmp/validation-result.json', 'utf8'));
4442
4543
// Find existing bot comment to update (avoid spam)
4644
const allComments = await github.paginate(
@@ -74,6 +72,14 @@ jobs:
7472
});
7573
}
7674
75+
- name: Update labels
76+
uses: actions/github-script@v7
77+
with:
78+
github-token: ${{ secrets.RELEASE_PAT }}
79+
script: |
80+
const fs = require('fs');
81+
const result = JSON.parse(fs.readFileSync('/tmp/validation-result.json', 'utf8'));
82+
7783
// Update labels — uses RELEASE_PAT so the label event
7884
// triggers the catalog-pr workflow
7985
const currentLabels = context.payload.issue.labels.map(l => l.name);
@@ -138,14 +144,12 @@ jobs:
138144
--catalog presets/catalog.community.json \
139145
--type preset
140146
141-
- name: Post validation comment and update labels
147+
- name: Post validation comment
142148
uses: actions/github-script@v7
143149
with:
144-
github-token: ${{ secrets.RELEASE_PAT }}
145150
script: |
146151
const fs = require('fs');
147152
const report = fs.readFileSync('/tmp/validation-report.md', 'utf8');
148-
const result = JSON.parse(fs.readFileSync('/tmp/validation-result.json', 'utf8'));
149153
150154
const allComments = await github.paginate(
151155
github.rest.issues.listComments,
@@ -178,6 +182,14 @@ jobs:
178182
});
179183
}
180184
185+
- name: Update labels
186+
uses: actions/github-script@v7
187+
with:
188+
github-token: ${{ secrets.RELEASE_PAT }}
189+
script: |
190+
const fs = require('fs');
191+
const result = JSON.parse(fs.readFileSync('/tmp/validation-result.json', 'utf8'));
192+
181193
const currentLabels = context.payload.issue.labels.map(l => l.name);
182194
183195
if (result.valid) {

0 commit comments

Comments
 (0)