Missed Team ’24? Catch up on announcements here.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Check for JIRA Key is missing in commits

Juan Carlos 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

Comment

Log in or Sign up to comment
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_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
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