How can I create a pull request that auto includes associated work item for the commits?
I'm trying to automate post-release processing. I'm running this code:
pull_request = {
"title": title,
"description": description,
"sourceRefName": "refs/heads/" + source_branch,
"targetRefName": "refs/heads/" + target_branch,
}
response = self._git_client.create_pull_request(pull_request, repository_id=repo_id)
It creates the pull request, but doesn't link any work items (like if I create it in the GUI). When I query the specific commits I can't seem to get the associated work items either, but the GUI is aware of them. Is there an option I need to specify to get this to automatically work, and if not, how can I find the associated work items to build the list myself?
Thanks,
-Derian Reuss
@ReussDr did you manage to find a solution for this problem?
I've moved on from the company I was with at the time, so I don't have access to the source, and while I've implemented something similar at the company I'm currently at the post-release branch handling is different.
I know that I was able to get the work items, but it required a multi-level approach (I believe I had to get the delta of all the commits between the head and target, use that to get the associated pull requests and finally hop from the pull requests to getting the work items). I think later I found out there was a way to get the pull requests directly from the commits, but you have to specify an extra parameter to tell it to bring back more information.
@JelleBruisten hope those details start you down the right path to figuring it out.
@dreuss-ka thank you for your response, we will try figure it out.