File: git-push-changes.yml

package info (click to toggle)
python-azure 20251014%2Bgit-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 766,472 kB
  • sloc: python: 6,314,744; ansic: 804; javascript: 287; makefile: 198; sh: 198; xml: 109
file content (48 lines) | stat: -rw-r--r-- 1,827 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
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 }}

- template: /eng/common/pipelines/templates/steps/emit-rate-limit-metrics.yml
  parameters:
    GitHubUser: azure-sdk
    GitHubToken: $(azuresdk-github-pat)

- 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 }}