Skip to content
This repository has been archived by the owner on Sep 11, 2023. It is now read-only.

Create Comment on PR in different Repo fails with error #19

Open
alexander-rabenstein opened this issue Mar 9, 2023 · 1 comment
Open
Labels
@task/PullRequestComments Issues related to the PullRequestComments task

Comments

@alexander-rabenstein
Copy link

I want to update an PR as part of a build triggered by a Pull request.
The definition for the pipeline is a different repository then the PR which triggered the build.
This throws an error:


Task         : Pull Request Comments
Description  : Add comments to a pull request
Version      : 0.4.1
Author       : Joachim Dalen
Help         : https://devops-extensions.dev/docs/extensions/pull-request-utils/tasks/pull-request-comments
==============================================================================
##[debug]Using node path: /home/vsts/agents/2.217.2/externals/node10/bin/node
##[debug]agent.TempDirectory=/home/vsts/work/_temp
##[debug]loading inputs and endpoints
##[debug]loading INPUT_ACTION
##[debug]loading INPUT_SKIPIFCOMMENTEXISTS
##[debug]loading INPUT_COMMENTID
##[debug]loading INPUT_STATUS
##[debug]loading INPUT_CONTENT
##[debug]loading INPUT_USEDEFINED
##[debug]loading INPUT_PULLREQUESTID
##[debug]loading INPUT_TYPE
##[debug]loading ENDPOINT_AUTH_SYSTEMVSSCONNECTION
##[debug]loading ENDPOINT_AUTH_SCHEME_SYSTEMVSSCONNECTION
##[debug]loading ENDPOINT_AUTH_PARAMETER_SYSTEMVSSCONNECTION_ACCESSTOKEN
##[debug]loading SECRET_SYSTEM_ACCESSTOKEN
##[debug]loaded 12
##[debug]Agent.ProxyUrl=undefined
##[debug]Agent.CAInfo=undefined
##[debug]Agent.ClientCert=undefined
##[debug]Agent.SkipCertValidation=undefined
##[debug]System.AccessToken=***
##[debug]System.TeamFoundationCollectionUri=https://dev.azure.com/xxx/
##[debug]Build.Repository.ID=70d68496-6a91-4137-a7a2-b64d01e5694e
##[debug]useDefined=false
##[debug]System.PullRequest.PullRequestId=362800
##[debug]content=This is a comment posted from pipeline CI_Ansible-lint
##[debug]skipIfCommentExists=true
##[debug]action=createOrUpdate
##[debug]type=Text
##[debug]task result: Failed
##[error]e is not iterable
##[debug]Processed: ##vso[task.issue type=error;]e is not iterable
##[debug]Processed: ##vso[task.complete result=Failed;]e is not iterable
Finishing: Post markdown comment

This is caused by following code line I think:

const repositoryId = tl.getVariable('Build.Repository.ID');

Either it should be possible to specify a different repo as a parameter, or the extension should use the pull request source repository if the build is triggered by a PR.

@joachimdalen joachimdalen added the @task/PullRequestComments Issues related to the PullRequestComments task label Mar 11, 2023
@joachimdalen
Copy link
Owner

Hi there, thank you for reporting.

That was actually a use case I did not consider when building the extension. I do see the usage of it and that it should be possible to do.

Unfortunately I don't have as much time as I'd like to maintain these extensions anymore, so I can't make a promise for when I'll be able to look over/fix this. I'll take a look when I get some time, but it might first be in a few weeks.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
@task/PullRequestComments Issues related to the PullRequestComments task
Projects
None yet
Development

No branches or pull requests

2 participants