-
Notifications
You must be signed in to change notification settings - Fork 183
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
102 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
parameters: | ||
PRBranchName: not-specified | ||
PROwner: azure-sdk | ||
CommitMsg: not-specified | ||
RepoOwner: Azure | ||
RepoName: $(Build.Repository.Name) | ||
PushArgs: | ||
WorkingDirectory: $(System.DefaultWorkingDirectory)' | ||
ScriptDirectory: eng/common/scripts | ||
SkipCheckingForChanges: false | ||
RemoteName: not-specified | ||
|
||
steps: | ||
- pwsh: | | ||
echo "git add -A" | ||
git add -A | ||
echo "git diff --name-status --cached --exit-code" | ||
git diff --name-status --cached --exit-code | ||
if ($LastExitCode -ne 0) { | ||
echo "##vso[task.setvariable variable=HasChanges]$true" | ||
echo "Changes detected so setting HasChanges=true" | ||
} | ||
else { | ||
echo "##vso[task.setvariable variable=HasChanges]$false" | ||
echo "No changes so skipping code push" | ||
} | ||
displayName: Check for changes | ||
condition: and(succeeded(), eq(${{ parameters.SkipCheckingForChanges }}, false)) | ||
workingDirectory: ${{ parameters.WorkingDirectory }} | ||
ignoreLASTEXITCODE: true | ||
|
||
- pwsh: | | ||
# Remove the repo owner from the front of the repo name if it exists there | ||
$repoName = "${{ parameters.RepoName }}" -replace "^${{ parameters.RepoOwner }}/", "" | ||
echo "##vso[task.setvariable variable=RepoNameWithoutOwner]$repoName" | ||
echo "RepoName = $repoName" | ||
displayName: Remove Repo Owner from Repo Name | ||
condition: succeeded() | ||
workingDirectory: ${{ parameters.WorkingDirectory }} | ||
|
||
- task: PowerShell@2 | ||
displayName: Push changes | ||
condition: and(succeeded(), eq(variables['HasChanges'], 'true')) | ||
inputs: | ||
pwsh: true | ||
workingDirectory: ${{ parameters.WorkingDirectory }} | ||
filePath: ${{ parameters.ScriptDirectory }}/git-branch-push.ps1 | ||
arguments: > | ||
-PRBranchName "${{ parameters.PRBranchName }}" | ||
-CommitMsg "${{ parameters.CommitMsg }}" | ||
-GitUrl "https://$(azuresdk-github-pat)@github.com/${{ parameters.PROwner }}/$(RepoNameWithoutOwner).git" | ||
-PushArgs "${{ parameters.PushArgs }}" | ||
-SkipCommit $${{ parameters.SkipCheckingForChanges }} | ||
-RemoteName ${{ parameters.RemoteName }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters