-
Notifications
You must be signed in to change notification settings - Fork 183
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
The common scripts of PR git diff changes. #2824
Conversation
The following pipelines have been queued for testing: |
The following pipelines have been queued for testing: |
[string] $SourceCommittish = ${env:BUILD_SOURCEVERSION}, | ||
[string] $TargetCommittish = ("origin/${env:SYSTEM_PULLREQUEST_TARGETBRANCH}" -replace "refs/heads/") | ||
) | ||
# Git PR diff: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-comparing-branches-in-pull-requests#three-dot-and-two-dot-git-diff-comparisons |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I imagine our link checker won't like the /en/
segment in there
The following pipelines have been queued for testing: |
The following pipelines have been queued for testing: |
The following pipelines have been queued for testing: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works for the eng/common workflow enforcer case
if(!$changedFiles) { | ||
Write-Host "No changed files in git diff between $TargetCommittish and $SourceCommittish" | ||
} | ||
foreach ($file in $changedFiles) { | ||
Write-Host "The diff file is: $file" | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if(!$changedFiles) { | |
Write-Host "No changed files in git diff between $TargetCommittish and $SourceCommittish" | |
} | |
foreach ($file in $changedFiles) { | |
Write-Host "The diff file is: $file" | |
} | |
if(!$changedFiles) { | |
Write-Host "No changed files in git diff between $TargetCommittish and $SourceCommittish" | |
} | |
foreach ($file in $changedFiles) { | |
Write-Host "The diff file is: $file" | |
} |
Hello @azure-sdk! Because this pull request has the p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (
|
Write-Host "Here are the diff files:" | ||
foreach ($file in $changedFiles) { | ||
Write-Host " $file" | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should put this block inside the else from above so we don't end up with extra logging in the empty case.
param ( | ||
[string] $SourceCommittish = "${env:BUILD_SOURCEVERSION}", | ||
[string] $TargetCommittish = ("origin/${env:SYSTEM_PULLREQUEST_TARGETBRANCH}" -replace "refs/heads/") | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We probably also need an optional parameter to pass in a path filter. (i.e. for things like eng/common).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, a new code changes proposed in PR
#2861
Have a common script for git diff changes.
Test proposal:
PR triggered(Compliance credscan): Azure/azure-sdk-for-js#20643
Manually triggered(Build print diff): https://dev.azure.com/azure-sdk/internal/_build/results?buildId=1407323&view=results
Test on Add, Update, Delete, Rename cases(Compliance credscan): Azure/azure-sdk-for-js#20643
Test on sparse-checkout cases(Build print diff): Azure/azure-sdk-for-java#27335
The git diff changes will add the file outside of the sparse checkout