How to enable "merge checks" on new repository automatically on "create repository event" ?

Roopa_Chandrasekaraiah
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 12, 2018

Hi

I am trying to auto enable "custom merge check" on new repositories created. I cannot  add it at Project level to make it inherit the check since I do not want to add this check to all repos under it. Please suggest me how to achieve it. 

I was planning to write a event handler using RepositoryCreatedEvent and enable the check for the new project created in "Script Event Handlers". But not finding a way to retrieve the "custom merge check" in that. PLease let me know if there is better option. 

Thanks for your help in advance.

 

 

1 answer

0 votes
Dick
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 3, 2018

Hi Roopa,

Did you have a look at the REST API? You should be able to achieve this by POSTing to:

/rest/projects/{projectKey}/settings/pull-requests/{scmId}

Please see the documentation for that endpoint:

Update the pull request merge strategy configuration for this project and SCM.

The authenticated user must have PROJECT_ADMIN permission for the context repository to call this resource.

Only the strategies provided will be enabled, the default must be set and included in the set of strategies.

Do note that this API is only available since 4.9.0.

I hope this helps!

Roopa_Chandrasekaraiah
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 5, 2018

Thank you Dick Wiggers.... But this is apparently not listing out the custom merge checks... I do not know how to access custom merge checks through APIs to get information about its id and other stuff.. Any information regarding this would be very helpful. Look forward to your response.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events