0

I have a scenario where I don't want to allow merging a Pull Request in Github if the title doesn't have a valid JIRA ticket number. I am using Jenkins for our CI/CD so wanted to do some checks using Jenkins itself. I am planning to fail a build in the CI if the build is triggered by merging a Pull Request and the title doesn't have a valid JIRA ticket number in it.

I am using GitHub organization job and did come across github scm filter plugin which claims to provide the PR title checks but after configuring, it doesn't work for me.

Is there a way where I can achieve the PR title checks using Jenkins? or is there a better way of doing this?

ANURAG parchuri
  • 115
  • 2
  • 8

1 Answers1

0

You could do it manually. You first need to get the PR title when the build starts using either a Jenkins plugin that works with GitHub, or by using the GitHub API. You can then use regex to extract possible Jira IDs (see this answer).

You could then use a Jira plugin for Jenkins (such as this one) or the Jira Rest API to search for the Jira ID. If the ID exists, then you're good to go. Otherwise, you could fail the build.

M B
  • 2,700
  • 2
  • 15
  • 20