Skip to content

Adding new param to link PR to work items to account for cross project linking #333

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 24, 2025

Conversation

danhellem
Copy link
Contributor

@danhellem danhellem commented Jul 23, 2025

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)

Test Updates:

  • New Test Cases for Cross-Project Linking:

  • Parameter Updates in Existing Tests:

    • Updated existing test cases to include the pullRequestProjectId parameter where relevant. (test/src/tools/workitems.test.ts, [1] [2] [3]

GitHub issue number #330

Associated Risks

None

PR Checklist

  • I have read the contribution guidelines
  • I have read the code of conduct guidelines
  • Title of the pull request is clear and informative.
  • 👌 Code hygiene
  • 🔭 Telemetry added, updated, or N/A
  • 📄 Documentation added, updated, or N/A
  • 🛡️ Automated tests added, or N/A

🧪 How did you test it?

Updated tests and tested manually

@danhellem danhellem requested a review from a team as a code owner July 23, 2025 14:16
@danhellem danhellem self-assigned this Jul 23, 2025
Copy link

github-actions bot commented Jul 23, 2025

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@danhellem danhellem added the Waiting for Merge 🚘 waiting for pull request to merge label Jul 23, 2025
Copy link
Contributor

@polatengin polatengin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, I left a nitpick comment

try {
const connection = await connectionProvider();
const workItemTrackingApi = await connection.getWorkItemTrackingApi();

// Create artifact link relation using vstfs format
// Format: vstfs:///Git/PullRequestId/{project}/{repositoryId}/{pullRequestId}
const artifactPathValue = `${projectId}/${repositoryId}/${pullRequestId}`;
const artifactProjectId = pullRequestProjectId && pullRequestProjectId.trim() !== "" ? pullRequestProjectId : projectId;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could be simplified as;

Suggested change
const artifactProjectId = pullRequestProjectId && pullRequestProjectId.trim() !== "" ? pullRequestProjectId : projectId;
const artifactProjectId = pullRequestProjectId?.trim() || projectId;

@danhellem danhellem merged commit 382f4d0 into main Jul 24, 2025
7 checks passed
@danhellem danhellem deleted the users/danhellem/pr-project-id-issue-330 branch July 24, 2025 14:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Waiting for Merge 🚘 waiting for pull request to merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cross-project work item linking uses incorrect project ID in vstfs URL
3 participants