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

Add new Azure DevOps PullRequestNumber env var #257

Merged
merged 3 commits into from
Apr 2, 2021

Conversation

jlindsayDev
Copy link
Contributor

@jlindsayDev jlindsayDev commented Feb 11, 2021

Add support for Azure DevOps change in pull request number environment variable
https://docs.microsoft.com/en-us/azure/devops/pipelines/build/variables?view=azure-devops&tabs=yaml#system-variables-devops-services

System.PullRequest.PullRequestId

The ID of the pull request that caused this build. For example: 17. (This variable is initialized only if the build ran because of a Git PR affected by a branch policy).

System.PullRequest.PullRequestNumber

The number of the pull request that caused this build. This variable is populated for pull requests from GitHub which have a different pull request ID and pull request number. This variable is only available in a YAML pipeline if the PR is a affected by a branch policy.

Comment on lines +721 to +722
environment._env.SYSTEM_PULLREQUEST_PULLREQUESTID = '512';
environment._env.SYSTEM_PULLREQUEST_PULLREQUESTNUMBER = '524';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm unsure if we'll need to add another variable to the CLI for the case a GitHub PR triggers an Azure DevOps build. From my tests so far env.SYSTEM_PULLREQUEST_PULLREQUESTNUMBER has always been null

This variable is populated for pull requests from GitHub which have a different pull request ID and pull request number.

Copy link
Contributor

@cadeParade cadeParade left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🦄

Copy link
Contributor

@wwilsman wwilsman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎮

Could we get the same change over in @percy/env? 😃

@jlindsayDev
Copy link
Contributor Author

Update here: holding off on merging since we might have to change more env variables to get the correct branch name, too. Additionally, I've shifted focus to ensuring we can fetch this information asynchronously via the APIs before integrating preemptive changes to the SDK.

Will revisit this mid next week, when I predict I'll have a better understanding of what other minor changes would have to be made to the SDK to support Azure DevOps

@jlindsayDev
Copy link
Contributor Author

Was looking into capturing additional environment variables, but might not be as valuable in the grand scheme of things since it would require a great deal of refactoring. Will create a new PR if the need arises.

@jlindsayDev jlindsayDev merged commit 97d3bfb into master Apr 2, 2021
@jlindsayDev jlindsayDev deleted the josh/add-azure-envvar branch April 2, 2021 23:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants