Open gyssels opened 4 years ago
This is still an issue. Please fix this. It makes the az repos pr create
command useless if you want the work items associated.
Here is a workaround I came up with. It searches through all commit messages in the current branch looking for messages that have included a work item number. It then validates it's a valid work item and produces an array WORKITEM_LIST
that can be passed to the --work-items
parameter of the az repos pr create
command. For example az repos pr create --title myPR ... --work-items "${WORKITEM_LIST[@]}"
# Get list of all possible work items contained within commit messages by searching all commit messages in this branch that match the pattern #number(s)
POSSIBLE_WORKITEM_LIST=$(git log origin/master.. --grep='#[0-9]' --pretty=format:'%B' | grep -o '#[0-9]\+' | tr -d '#' | sort -f | uniq -i | tr '\n' ' ')
echo "Possible work item numbers are... $POSSIBLE_WORKITEM_LIST"
WORKITEM_LIST=()
# Loop thorugh the list of possible work items and confirm they are in fact valid work item numbers
for WORKITEM in $POSSIBLE_WORKITEM_LIST; do
echo "Checking if $WORKITEM is a valid work item number ..."
if az boards work-item show --id "$WORKITEM"; then
echo "$WORKITEM is a valid work item number"
WORKITEM_LIST+=("${WORKITEM}")
else
echo "$WORKITEM is not a valid work item number"
fi
done
Looking for this to either happen automatically, or a workaround. We are using a pipeline to create develop -> main PRs for multiple different repositories at the same time, but work items don't get linked.
Describe the bug When creating a merge from the interface ALL work-items from the git commit command are linked to the PR. while doing the command line the work-items need to be enumerated with the switch "--work-items" otherwise we need to do manually on the web interface afterward. It upset my team as we carefully enlist our work-items on commits. Some of my developers are stoping to link on commits... intruding bad behavior. please fix it soon.
To Reproduce -Azure-Devops extension version: azure-cli 2.0.81 * -Extensions: azure-devops 0.17.0
Steps to reproduce the behavior: