azure-sdk-for-cpp/eng/common/pipelines/templates/steps/git-push-changes.yml
Azure SDK Bot d390750361
Sync eng/common directory with azure-sdk-tools for PR 7892 (#5451)
* Move git check for changes to script

* Minor fixes for 1es migration

---------

Co-authored-by: Ben Broderick Phillips <bebroder@microsoft.com>
2024-03-15 17:24:05 -04:00

44 lines
1.6 KiB
YAML

parameters:
BaseRepoBranch: not-specified
BaseRepoOwner: azure-sdk
CommitMsg: not-specified
TargetRepoOwner: Azure
TargetRepoName: $(Build.Repository.Name)
PushArgs:
WorkingDirectory: $(System.DefaultWorkingDirectory)'
ScriptDirectory: eng/common/scripts
SkipCheckingForChanges: false
steps:
- task: PowerShell@2
displayName: Check for changes
condition: and(succeeded(), eq(${{ parameters.SkipCheckingForChanges }}, false))
inputs:
pwsh: true
workingDirectory: ${{ parameters.WorkingDirectory }}
filePath: ${{ parameters.ScriptDirectory }}/check-for-git-changes.ps1
ignoreLASTEXITCODE: true
- pwsh: |
# Remove the repo owner from the front of the repo name if it exists there
$repoName = "${{ parameters.TargetRepoName }}" -replace "^${{ parameters.TargetRepoOwner }}/", ""
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.BaseRepoBranch }}"
-CommitMsg "${{ parameters.CommitMsg }}"
-GitUrl "https://$(azuresdk-github-pat)@github.com/${{ parameters.BaseRepoOwner }}/$(RepoNameWithoutOwner).git"
-PushArgs "${{ parameters.PushArgs }}"
-SkipCommit $${{ parameters.SkipCheckingForChanges }}