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
I have searched issues to ensure it has not already been reported
Cake runner
Cake Frosting
Cake version
5.0.0
Operating system
Windows
Operating system architecture
x64
CI Server
Azure DevOps
What are you seeing?
When running a build for a GitHub Pull Request on Azure Pipelines, AzurePipelinesPullRequestInfo.Id returns 0 and AzurePipelinesPullRequestInfo.IsPullRequest returns false even though the corresponding environment variables are set by Azure Pipelines
Analysis
I think I already found the root cause for the issue:
The Pull Request Id is stored as int but the Ids on github,com exceeded int.MaxValue some time ago (for example, in one recent PR I opened, the id was 2246475303)
The fix would be to use long instead, but I guess this would be a breaking change
Workaround
As a workaround for detecting if a build is a PR build, check if AzurePipelinesPullRequestInfo.Number is greater than 0.
This will return the Pull Request number as shown in the GitHub UI, which should fir well within a int
What is expected?
AzurePipelinesPullRequestInfo.IsPullRequest should return true
AzurePipelinesPullRequestInfo.Id should return the id of the pull request (this is different from the PR number)
Steps to Reproduce
Example of a Cake.Frosting-based build that runs into this can be seen here
Set up a Cake.Frosting-based build in a GitHub-hosted repository
Set up a pipeline on Azure Pipelines
In the build, access context.AzurePipelines().Environment.PullRequest.Id or context.AzurePipelines().Environment.PullRequest.IsPullRequest
Output log
No response
The text was updated successfully, but these errors were encountered:
Prerequisites
Cake runner
Cake Frosting
Cake version
5.0.0
Operating system
Windows
Operating system architecture
x64
CI Server
Azure DevOps
What are you seeing?
When running a build for a GitHub Pull Request on Azure Pipelines,
AzurePipelinesPullRequestInfo.Id
returns0
andAzurePipelinesPullRequestInfo.IsPullRequest
returns false even though the corresponding environment variables are set by Azure PipelinesAnalysis
I think I already found the root cause for the issue:
int
but the Ids on github,com exceededint.MaxValue
some time ago (for example, in one recent PR I opened, the id was2246475303
)long
instead, but I guess this would be a breaking changeWorkaround
As a workaround for detecting if a build is a PR build, check if
AzurePipelinesPullRequestInfo.Number
is greater than0
.This will return the Pull Request number as shown in the GitHub UI, which should fir well within a
int
What is expected?
AzurePipelinesPullRequestInfo.IsPullRequest
should return trueAzurePipelinesPullRequestInfo.Id
should return the id of the pull request (this is different from the PR number)Steps to Reproduce
Example of a Cake.Frosting-based build that runs into this can be seen here
context.AzurePipelines().Environment.PullRequest.Id
orcontext.AzurePipelines().Environment.PullRequest.IsPullRequest
Output log
No response
The text was updated successfully, but these errors were encountered: