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
Adding new param to link PR to work items to account for cross project linking (#333)
This pull request introduces support for linking pull requests across
different projects by adding an optional `pullRequestProjectId`
parameter. It includes updates to both the implementation and
corresponding tests to handle this new functionality.
### Feature Enhancements:
* **Cross-Project Linking Support**:
- Added an optional `pullRequestProjectId` parameter in the
`configureWorkItemTools` function to allow linking pull requests from a
different project. If not provided, it defaults to the `projectId` for
same-project linking. (`src/tools/workitems.ts`,
[src/tools/workitems.tsR367-R377](diffhunk://#diff-86312c74c8d340f1b252bb6a34ae3d610c400cf9151d45223ec54d2d2ab2b0c9R367-R377))
### Test Updates:
* **New Test Cases for Cross-Project Linking**:
- Added a test to verify that `pullRequestProjectId` is used instead of
`projectId` when provided. (`test/src/tools/workitems.test.ts`,
[test/src/tools/workitems.test.tsR565-R642](diffhunk://#diff-81b8c1c7196cc4eba4c6b2a30eaec7c3101f72c5a88803d07b942b71e3404b9dR565-R642))
- Added a test to ensure fallback to `projectId` when
`pullRequestProjectId` is empty. (`test/src/tools/workitems.test.ts`,
[test/src/tools/workitems.test.tsR565-R642](diffhunk://#diff-81b8c1c7196cc4eba4c6b2a30eaec7c3101f72c5a88803d07b942b71e3404b9dR565-R642))
* **Parameter Updates in Existing Tests**:
- Updated existing test cases to include the `pullRequestProjectId`
parameter where relevant. (`test/src/tools/workitems.test.ts`,
[[1]](diffhunk://#diff-81b8c1c7196cc4eba4c6b2a30eaec7c3101f72c5a88803d07b942b71e3404b9dR658)
[[2]](diffhunk://#diff-81b8c1c7196cc4eba4c6b2a30eaec7c3101f72c5a88803d07b942b71e3404b9dL1238-R1321)
[[3]](diffhunk://#diff-81b8c1c7196cc4eba4c6b2a30eaec7c3101f72c5a88803d07b942b71e3404b9dL1260-R1344)
## GitHub issue number #330
## **Associated Risks**
None
## ✅ **PR Checklist**
- [x] **I have read the [contribution
guidelines](https://github.com/microsoft/azure-devops-mcp/blob/main/CONTRIBUTING.md)**
- [ ] **I have read the [code of conduct
guidelines](https://github.com/microsoft/azure-devops-mcp/blob/main/CODE_OF_CONDUCT.md)**
- [x] Title of the pull request is clear and informative.
- [x] 👌 Code hygiene
- [x] 🔭 Telemetry added, updated, or N/A
- [x] 📄 Documentation added, updated, or N/A
- [x] 🛡️ Automated tests added, or N/A
## 🧪 **How did you test it?**
Updated tests and tested manually
repositoryId: z.string().describe("The ID of the repository containing the pull request. Do not use the repository name here, use the ID instead."),
365
365
pullRequestId: z.number().describe("The ID of the pull request to link to."),
366
366
workItemId: z.number().describe("The ID of the work item to link to the pull request."),
367
+
pullRequestProjectId: z.string().optional().describe("The project ID containing the pull request. If not provided, defaults to the work item's project ID (for same-project linking)."),
0 commit comments