feat: add automatic AB# tagging from branch name#152
feat: add automatic AB# tagging from branch name#152joshjohanning wants to merge 12 commits intomainfrom
Conversation
Add new `add-ab-tag-from-branch` input that extracts work item IDs from the head branch name and appends AB#xxx to the PR body if not already present. Supports common branch formats like task/12345/description, task-12345, 12345-description, and more. closes #151
…fy usage with check-pull-request
… digit IDs and update related documentation
- add-work-item-from-branch now requires azure-devops-token and azure-devops-organization; extracted IDs are always validated against Azure DevOps before being added to the PR body - Remove 3-digit minimum from branch regex since validation catches false positives - Sanitize branch name in job summary to prevent markdown injection - Fix JSDoc param type for extractWorkItemIdsFromBranch - Clean up dangling append-work-item-title test references - Add tests for validation of branch-extracted IDs and missing token
- Fix GHAS incomplete string escaping: escape backslashes in branchName - Allow add-work-item-from-branch as standalone (update guard condition) - Cap branch ID extraction at 5 to limit API calls - Fix misleading azure-devops-token/organization descriptions in README - Add test for standalone branch extraction usage
|
Moving this back to draft while I work through the false positive problem with branch name extraction. The core issue: extracting bare numbers from branch names (e.g. The 3-digit minimum helps with very short numbers ( Still thinking through the best approach here. Some options under consideration:
Will update once I have a cleaner solution. cc @davetevans |
|
I would vote for the prefix pattern matching |
Only extract work item IDs from branch names when they follow a recognized keyword prefix (e.g. task/12345, bug-67890) instead of matching any bare number. This prevents false positives from year-like numbers or version segments in branch names. Add configurable `branch-work-item-prefixes` input (default: task, bug, bugfix) so users can customize the keyword list. Resolves the false positive concern raised in #151.
Summary
Add new
add-work-item-from-branchinput that extracts work item IDs from the head branch name and addsAB#xxxto the PR body if not already present. Each extracted ID is validated against Azure DevOps before being added, preventing false positives from version numbers or other numeric patterns in branch names.Resolves #151
Changes
add-work-item-from-branchinput - extracts work item IDs from branch names that follow a keyword prefix pattern (e.g.task/12345,bug-67890)branch-work-item-prefixesinput - configurable comma-separated list of keyword prefixes (default:task, bug, bugfix)azure-devops-tokenandazure-devops-organization; each ID is checked against Azure DevOps and only valid work items are added to the PR body. Invalid IDs are skipped with a warning.main- includes thenode24runtime upgrade and theadd-work-item-tablefeaturepackage.jsonscripts with standard template (format:write,ci-test,bundle,package:watch, etc.)copilot-instructions.mdfor better agent compliancecopilot-instructions.mdinaccuracies (getInput()reference, template literal guidance)Supported branch formats
task/12345/make-it-betterAB#12345task/12345-make-it-betterAB#12345task-12345AB#12345task_12345AB#12345bug/12345/task/67890AB#12345,AB#67890users/josh/task/12345/fixAB#1234512345-make-it-betterhotfix/2024-bugfixfeature-v2-add-loggingDesign decisions
task,bug,bugfix) and a separator (/,-,_). This avoids false positives from year-like numbers or version strings in branch names.hotfix/12345does NOT match when prefix isfix, becausefixinhotfixis preceded by a letter, not a separator or start-of-stringvalidate-work-item-existsis independent -add-work-item-from-branchhas validation built in.validate-work-item-existsseparately controls whether human-writtenAB#references in commits/PR body are validated.AB#tags satisfy subsequentcheck-pull-requestvalidation