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
[Remove Links from a Work Item](#remove-one-or-more-links-from-a-work-item)
13
+
[Remove Links from a Work Item](#remove-one-or-more-links-from-a-work-item)<br/>
14
+
[Adding Artifact Links](#adding-artifact-links)
14
15
15
16
## 🙋♂️ Projects and Teams
16
17
@@ -149,3 +150,21 @@ Next, remove a specific link to a work item, pull request, etc. or remove links
149
150
```plaintext
150
151
Remove link 5678 and 91011 from work item 1234. Also remove any related links and links to pull request 121314
151
152
```
153
+
154
+
## 🔗 Adding Artifact Links
155
+
156
+
### Add Artifact Links to Work Items
157
+
158
+
Use this tool to link work items to repository artifacts like branches, commits, and pull requests. This is particularly useful for GitHub Copilot integration, which requires artifact links to understand repository context.
159
+
160
+
First, you'll need the proper vstfs URI format for your artifact:
Add a branch artifact link to work item 1234 in project "Contoso" with URI "vstfs:///Git/Ref/12341234-1234-1234-1234-123412341234%2F12341234-1234-1234-1234-123412341234%2FGBmain" and link type "Branch" with comment "Linked to main branch for GitHub Copilot integration"
168
+
```
169
+
170
+
📽️ [Adding artifact links enables automation of work item creation and GitHub Copilot integration]()
"Add artifact links (repository, branch, commit, builds) to work items. You can either provide the full vstfs URI or the individual components to build it automatically.",
866
+
{
867
+
workItemId: z.number().describe("The ID of the work item to add the artifact link to."),
868
+
project: z.string().describe("The name or ID of the Azure DevOps project."),
869
+
870
+
// Option 1: Provide full URI directly
871
+
artifactUri: z.string().optional().describe("The complete VSTFS URI of the artifact to link. If provided, individual component parameters are ignored."),
872
+
873
+
// Option 2: Provide individual components to build URI automatically based on linkType
874
+
projectId: z.string().optional().describe("The project ID (GUID) containing the artifact. Required for Git artifacts when artifactUri is not provided."),
875
+
repositoryId: z.string().optional().describe("The repository ID (GUID) containing the artifact. Required for Git artifacts when artifactUri is not provided."),
876
+
branchName: z.string().optional().describe("The branch name (e.g., 'main'). Required when linkType is 'Branch'."),
877
+
commitId: z.string().optional().describe("The commit SHA hash. Required when linkType is 'Fixed in Commit'."),
878
+
pullRequestId: z.number().optional().describe("The pull request ID. Required when linkType is 'Pull Request'."),
879
+
buildId: z.number().optional().describe("The build ID. Required when linkType is 'Build', 'Found in build', or 'Integrated in build'."),
880
+
881
+
linkType: z
882
+
.enum([
883
+
"Branch",
884
+
"Build",
885
+
"Fixed in Changeset",
886
+
"Fixed in Commit",
887
+
"Found in build",
888
+
"Integrated in build",
889
+
"Model Link",
890
+
"Pull Request",
891
+
"Related Workitem",
892
+
"Result Attachment",
893
+
"Source Code File",
894
+
"Tag",
895
+
"Test Result",
896
+
"Wiki",
897
+
])
898
+
.default("Branch")
899
+
.describe("Type of artifact link, defaults to 'Branch'. This determines both the link type and how to build the VSTFS URI from individual components."),
900
+
comment: z.string().optional().describe("Comment to include with the artifact link."),
content: [{type: "text",text: `URI building from components is not supported for link type '${linkType}'. Please provide the full 'artifactUri' instead.`}],
960
+
isError: true,
961
+
};
962
+
}
963
+
}
964
+
965
+
// Create the patch document for adding an artifact link relation
966
+
constpatchDocument=[
967
+
{
968
+
op: "add",
969
+
path: "/relations/-",
970
+
value: {
971
+
rel: "ArtifactLink",
972
+
url: finalArtifactUri,
973
+
attributes: {
974
+
name: linkType,
975
+
...(comment&&{ comment }),
976
+
},
977
+
},
978
+
},
979
+
];
980
+
981
+
// Use the WorkItem API to update the work item with the new relation
0 commit comments