Ram*_*ran 5 github github-actions
我们有一个 Jenkins CI 作业,当提出拉取请求时,我们将在其中运行作业。如果该作业在任何情况下失败,我们就不应该允许用户合并拉取请求。我们有什么办法可以使用 github actions 来做吗?
你可以:
\nOP Ramanichandran在评论中确认其正在发挥作用:
\n\n\n对于 jenkins 中的每个失败阶段,我们称之为 github api
\n
sh(\'curl "https://api.github.com/repos/reponame/statuses/$GIT_COMMIT?access_token=xxx" \\ \n-H "Content-Type: application/json" \\ \n-X POST \\ \n-d "{\\\\\\"state\\\\\\": \\\\\\"failure\\\\\\", \\\\\\"target_url\\\\\\": \\\\\\"https://jenkinsurl/job/foldername/job/jobname/$BUILD_NUMBER/console\\\\\\", \\\\\\"description\\\\\\": \\\\\\"Jenkins-CI-pre-merge-job-sonarscan-failure\\\\\\", \\\\\\"context\\\\\\": \\\\\\"Jenkins-CI-pre-merge-job-sonarscan-failure\\\\\\"}"\') } \xe2\x80\x93\nRun Code Online (Sandbox Code Playgroud)\n