The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Check for JIRA Key is missing in commits

Juan Carlos
Contributor
April 26, 2024

I would like to check if a commit is missing a Jira key, and prevent a marge if it does, is this possible right now? Im just getting started but I still have much to learn

2 comments

Comments for this post are closed

Community moderators have prevented the ability to post new comments.

Edmund Munday
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 28, 2024

Hi @Juan Carlos - awesome question, thanks for asking!

  • This is 100% possible today, and very simple.
  • The first step is to use the `requestBitbucket` Forge API function to call the Bitbucket API to retrieve all the commits on the Pull Request.
  • That call will return a list of all the commits on the Pull Request, including the details of the authors, and all the commit messages.
  • From there, you would just need to iterate over each commit and check for what you are looking for.
    • There's a bunch of ways you can handle searching for the project keys.
      • If the list of projects is short and relatively stable, you can just hard-code them into your app.
        • This is what I'd suggest during testing.
      • You could create a generic REGEX pattern to identify ANY Jira issue keys.
      • Or you could implement some front-end UI using Forge UI to allow people to configure the projects they want to include in the check without having to make code changes.
        • This is a little bit more advanced as a use-case, so I'd suggest leaving this until you're a bit more comfortable with the other parts of the process.
Like Juan Carlos likes this
Saxea _Flowie_
Atlassian Partner
April 28, 2024

Hi @Juan Carlos ,

Flowie, a Bitbucket Cloud app we provide, has a plugin specifically for validating commits and preventing merge by creating checks. 

Hope it helps!

 

Like Juan Carlos likes this
TAGS
AUG Leaders

Atlassian Community Events