Azure拉的请求|蓝否-"你必须提供一个值表达以下的"+"操作"。

0

的问题

目前,我正在运行此其文件:

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

我解决我的问题通过添加以下模板我的公关说明:

描述 谢谢你的贡献Bla Bla回购。 在提交之前这PR,请做出肯定的:

  • []修复
  • []特征
  • []大

注:如果你希望有不同的术语中,你将不得不改变regex的一部分。 作为一个例子:

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

在同一时间,你将不得不做出改变内部的框添加内部的请求,以确保它会比赛。

现在,脚本是工作。 如果你想看到的指导,以增加语版本控制来项目中,你将必须看指导的创建者的链接: https://www.moderndata.ai/2021/10/automatic-semantic-versioning-in-azure-devops-with-release-notes/. 看看主要问题,我创造了- $(系统。PullRequest.SourceBranch)没有发现.

2021-11-24 20:07:00

你原来的追求,是个混犯的错误。 怎么,你的回答解决问题吗?
John Hanley

添加git提交信息SemVer Powershell脚本有一些regex,将采取在地方框,以确保我将能够宣布如果我请求将一个修复、特征或大。 通过添加的形式上的公关意见得到解决的问题
Hvaandres

这就是我的答案,我加入该模板对我的评论里面的我的公关,选择的选项,我需要。 读过剧本,你会看到,regex是问你的选择框,如果添加这些内的你的公关意见,你将能够发挥与这个脚本。 脚本本身有什么错,我没有理解其在开始的,但是现在我得到解决和我分享的指导,我跟随
Hvaandres

其他语言

此页面有其他语言版本

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