Azure 기|Azure Devops-"값을 제공해야 합 식음에'+'연산자입니다."

0

질문

나는 현재 실행 중인 이 yaml file:

trigger:
- none
## notes 
pool:
  vmImage: ubuntu-latest

## Job to calculate semantic version
jobs:
  - job: CalculateVersion
    displayName: Semantic versioning
    
    steps:
      # Checkout with persist credentials
      - checkout: self
        persistCredentials: true

      # Install GitVersion
      - task: gitversion/setup@0
        displayName: Install GitVersion
        inputs:
          versionSpec: '5.x'

      # Retrieve Pull Request Description
      - task: PullRequestDescription@0
        name: RetrievePullRequestDescription
        displayName: Retrieve Pull Request description
        inputs:
          action: 'view'
          outputVariable: 'PullRequest.DescriptionContent'
          isOutput: true
          stripIdentifiers: false

      # Add git commit message that will be picked up by GitVersion ("+semver: patch/minor/major")
      # Depending on the Pull Request description, where the developer has marked the type of change
      - task: PowerShell@2
        displayName: Add git commit message for SemVer
        inputs:
          targetType: inline
          script: |
            Write-Host "Configuring git author info.." -ForegroundColor Cyan
          
            git config user.email "[email protected]"
            git config user.name "alan.haro"
            Write-Host "Doing git checkout..." -ForegroundColor Cyan
            git checkout -b $("$(System.PullRequest.SourceBranch)".replace('refs/heads/creating-git-tags', ''))
            Write-Host "Checking Pull Request description..." -ForegroundColor Cyan
            $PRdesc = "$(RetrievePullRequestDescription.PullRequest.DescriptionContent)"
            if ($PRdesc -match '(\[x\] \bFix\b)') {
              Write-Host "Adding git (empty) commit message to mark this branch as a 'patch' SemVer increment." -ForegroundColor Cyan
              git commit -a -m "+semver: patch [skip azurepipelines]" --allow-empty
            } elseif ($PRdesc -match '(\[x\] \bFeature\b)') {
              Write-Host "Adding git (empty) commit message to mark this branch as a 'minor' SemVer increment." -ForegroundColor Cyan
              git commit -a -m "+semver: minor [skip azurepipelines]" --allow-empty
            } elseif ($PRdesc -match '(\[x\] \bBig\b)') {
              Write-Host "Adding git (empty) commit message to mark this branch as a 'major' SemVer increment." -ForegroundColor Cyan
              git commit -a -m "+semver: major [skip azurepipelines]" --allow-empty
            } else {
              Write-Host "##vso[task.LogIssue type=error;]Please select the type of change in the Pull Request description, and Re-queue the validation." -ForegroundColor Cyan
              $PRdesc
              exit 1
            }
            Write-Host "Doing git push.." -ForegroundColor Cyan
            git push --set-upstream origin $("$(System.PullRequest.SourceBranch)".replace('refs/heads/', ''))
            Write-Host "Done." -ForegroundColor Cyan
          
      # Determine the semantic version & test test
      - task: gitversion/execute@0
        displayName: Determine SemVer

이 잘 실행되는,내가 가진 것을 전달에서 다음 명령을 주석에서 새로운 PR:

git commit -a -m "+'semver: minor [skip azurepipelines]'" --allow-empty

이렇게 하여 나는 다음과 같은 문제점을 해결합니다.

"값을 제공해야 합 식음에'+'연산자입니다."

사람이 무엇을 알고 내가 할 수있는 다른 유형을 방지하기 위해 오류 메시지가 있습니까?

1

최고의 응답

-2

내 문제를 해결을 추가하여 다음과 같은 템플릿의 내부에 내 PR 설명:

설명 감사에 대한 기여를 즐 즐 repo. 를 제출하기 전에 이 PR,는지 확인하십시오:

  • []정
  • [능
  • []크

참고:하고 싶은 경우에는 다른 용어 변경해야 합니다 regex 부분입니다. 예를 들어:

 if ($PRdesc -match '(\[x\] \**bFix**\b)')

동일한 시간에,당신은 당신이 변화를 만들의 내부를 체크박스에 추가한의 내부에는 풀 요청을 확인하는 것이 일치합니다.

지금,스크립트가 작동됩니다. 만약 당신이보고 싶은 가이드를 추가하는 의미의 버전 관리는 귀하의 프로젝트가 보드의 창조자의 링크: https://www.moderndata.ai/2021/10/automatic-semantic-versioning-in-azure-devops-with-release-notes/. 주요한 문제는 내가 만들 $(시스템입니다.충돌이 발생.SourceBranch)없음을 발견.

2021-11-24 20:07:00

원래 퀘스트 git commit 오류가 있습니다. 어떻게 당신의 답변 문제를 해결할 수 있을까요?
John Hanley

추가 git commit 메시지에 대한 SemVer Powershell 스크립트가 어떤 regex 는 장소에서는 확인란을 확인하는 것이고 선언할 수 있는 경우 내 풀 요청이 될 수정,기능 또는 크다. 을 추가하여 양식 위에서 PR-댓글 문제를 해결
Hvaandres

나의 답변,나는 추가 템플릿한 의견의 내부에 내 PR,그리고 옵션을 선택하는 내가 필요합니다. 스크립트를 읽고,당신이 볼 수는 regex 요청에 대한 확인란을 추가하는 경우 그 내부에 PR 의견을 재생할 수 있는 이 스크립트입니다. 스크립트 자체가 잘못이 없고,이해하지 못했다 그것은 처음에는,그러나 이제는 내가 해결되 나는 공유되는 가이드 제가 다음
Hvaandres

다른 언어로

이 페이지는 다른 언어로되어 있습니다

Русский
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................