如何动态获取 sonar.pullrequest.key

huangapple go评论43阅读模式
英文:

How to obtain the sonar.pullrequest.key dynamically

问题

我正在为我的项目设置PR装饰,并在我的sonar-project.properties中添加以下配置:

sonar.pullrequest.provider=GitHub
sonar.pullrequest.github.repository=<repository>
sonar.pullrequest.base=main
sonar.pullrequest.branch=feature/*
sonar.pullrequest.key=5

然而,sonar.pullrequest.key我不希望它是静态的,而是在每次执行PR装饰的分析时都是最新的。

我正在使用Docker安装,使用Sonar进行分析,以及AWS Codebuild作为CI/CD。

如何始终传递最新的PR呢?

英文:

I am setting PR decoration for my project and I am adding the following configuration in my sonar-project.properties:

sonar.pullrequest.provider=GitHub
sonar.pullrequest.github.repository=<repository>
sonar.pullrequest.base=main
sonar.pullrequest.branch=feature/*
sonar.pullrequest.key=5

However, the sonar.pullrequest.key I don't want it to be static but every new PR the analysis for the PR decoration is performed.

I am using Docker to install, analyze with Sonar and AWS Codebuild as CI/CD.

How can I pass the most recent PR always?

答案1

得分: 1

以下是翻译好的部分:

sonar.pullrequest.key=${{github.event.pull_request.number}}
sonar.pullrequest.branch=${{github.head_ref}}
sonar.pullrequest.base=${{github.base_ref}}
英文:

For those use GitHub actions to do so, these might help:

sonar.pullrequest.key=${{github.event.pull_request.number}}
sonar.pullrequest.branch=${{github.head_ref}}
sonar.pullrequest.base=${{github.base_ref}}

huangapple
  • 本文由 发表于 2023年6月9日 07:00:34
  • 转载请务必保留本文链接:https://go.coder-hub.com/76436208.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定