parameters: 
  JavaDocJarLocation: ''
  ArtifactName: ''
  TargetBranch: ''
  DocRepoLocation: ''
  TargetDocRepoName: ''
  TargetDocRepoOwner: ''
  WorkingDirectory: $(System.DefaultWorkingDirectory)
steps:
  - template: /eng/common/pipelines/templates/steps/set-default-branch.yml
  - task: PowerShell@2
    displayName: Fetch package list from JavaDoc jar
    inputs:
      pwsh: true
      filePath: ${{ parameters.WorkingDirectory }}/eng/scripts/Fetch-PackageList-Javadoc.ps1
      arguments: >
        -JavaDocJarLocation ${{ parameters.JavaDocJarLocation }}
        -ArtifactName ${{ parameters.ArtifactName }}
        -DocRepoLocation ${{ parameters.DocRepoLocation }}
    continueOnError: true

  - template: /eng/common/pipelines/templates/steps/git-push-changes.yml
    parameters:
      BaseRepoBranch: ${{ parameters.TargetBranch }}
      BaseRepoOwner: ${{ parameters.TargetDocRepoOwner }}
      CommitMsg: "Update docs metadata for java package namespaces"
      TargetRepoName: ${{ parameters.TargetDocRepoName }}
      TargetRepoOwner: ${{ parameters.TargetDocRepoOwner }}
      WorkingDirectory: ${{ parameters.DocRepoLocation }}
