Skip to content
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

Handlebar extension, "lookup_a_pullrequest", not able to handle lowercase "%2f" in url string. #1980

Closed
henrikamnas opened this issue Sep 11, 2024 · 2 comments · Fixed by #1986

Comments

@henrikamnas
Copy link

henrikamnas commented Sep 11, 2024

Azure DevOps Extensions

Generate Release Notes (Node Cross Platform)

Platform

Azure DevOps Services

Azure DevOps Server (TFS) Version

No response

Extension Version

No response

Describe the bug

A few weeks ago the associated PRs for our work items in our releasenotes report started becoming empty on occasion.

I think the underlying issue is that Azure DevOps for some reason, in the relations array under the list of workitems, started returning the url string with a lowercase "%2f" which causes the split statement in the
"lookup_a_pullrequest" function here to not work as expected. Just adding a toUpperCase() there should solve the issue I think.

Let me know if I can assist in anyway possible!

Repo Steps

  1. Generate a releasenotes report that uses the lookup_a_pullrequest function to link workitems to pull request.
  2. On some cases the PRs will not be associated with the workitems.

Expected Behavior

For the pull request to be linked to the workitem.

Logging Information

Below is the handlebar template we are using:

Global list of WI with PRs, parents and children

{{#forEach this.workItems}}
{{#if isFirst}}### WorkItems {{/if}}

[{{this.id}}]({{replace this.url "_apis/wit/workItems" "_workitems/edit"}}) {{lookup this.fields 'System.Title'}}

  • WIT {{lookup this.fields 'System.WorkItemType'}}
  • Tags {{lookup this.fields 'System.Tags'}}
  • Assigned {{#with (lookup this.fields 'System.AssignedTo')}} {{displayName}} {{/with}}
  • PRs
    {{#forEach this.relations}}
    {{#if (contains this.attributes.name 'Pull Request')}}
    {{#with (lookup_a_pullrequest ../../pullRequests this.url)}}
    • [{{this.pullRequestId}}]({{replace (replace this.url "_apis/git/repositories" "_git") "pullRequests" "pullRequest"}}) {{this.title}}
      • Source branch: {{ replace this.sourceRefName "refs/heads/" "" }}
      • Target branch: {{ replace this.targetRefName "refs/heads/" "" }}
      • Created by: {{this.createdBy.displayName}}
      • Created at: {{this.creationDate}}
      • Approvers:
        {{#forEach this.reviewers}}
        • {{this.displayName}}
          {{/forEach}}
          {{/with}}
          {{/if}}
          {{/forEach}}
  • Parents
    {{#forEach this.relations}}
    {{#if (contains this.attributes.name 'Parent')}}
    {{#with (lookup_a_work_item ../../relatedWorkItems this.url)}}
    • [{{this.id}}]({{replace this.url "_apis/wit/workItems" "_workitems/edit"}}) {{lookup this.fields 'System.Title'}}
      {{#forEach this.relations}}
      {{#if (contains this.attributes.name 'Parent')}}
      {{#with (lookup_a_work_item ../../../../relatedWorkItems this.url)}}
      • #{{this.id}} - {{lookup this.fields 'System.Title'}}
        {{/with}}
        {{/if}}
        {{/forEach}}
        {{/with}}
        {{/if}}
        {{/forEach}}
  • Children
    {{#forEach this.relations}}
    {{#if (contains this.attributes.name 'Child')}}
    {{#with (lookup_a_work_item ../../relatedWorkItems this.url)}}
    • [{{this.id}}]({{replace this.url "_apis/wit/workItems" "_workitems/edit"}}) {{lookup this.fields 'System.Title'}}
      {{/with}}
      {{/if}}
      {{/forEach}}
  • Tested By
    {{#forEach this.relations}}
    {{#if (contains this.attributes.name 'Tested By')}}
    {{#with (lookup_a_work_item ../../testedByWorkItems this.url)}}
    • [{{this.id}}]({{replace this.url "_apis/wit/workItems" "_workitems/edit"}}) {{lookup this.fields 'System.Title'}}
      {{/with}}
      {{/if}}
      {{/forEach}}
      {{/forEach}}
@rfennell
Copy link
Owner

I will look to getting this addressed

@rfennell
Copy link
Owner

Fixed in 4.19.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants