Create pull request with given author gives error

Currently the goal is to create pull request autmatically upon each push to origin, if it is not existing. It would be good to set pull request author to other than the one logged into API, but ... the request is not possible in that case. Datastructure used:

{
            'title': 'name for PR here...',
            'reviewers': [{user.username for user in get_required_users()],
            'author': {
                'role': 'AUTHOR',
                'user': {'name': 'bigmacaronnimonster'}
            },
            'toRef': {'id': mainline, 'repository': repository},
            'fromRef': {'id': branch, 'repository': repository}
      }

So, the question could also be - 'Is it possible to do that?'

1 answer

1 vote
Jason Hinch Atlassian Team Jan 20, 2013

Currently there is no way to do this via REST. The author of the pull request will be set to the authenticated user. You could do this via a plugin though by calling create() method on the PullRequestService whilst wrapped in a doAsUser() method call on the SecurityService.

I've created a feature request for exposing the functionality via REST at:

https://jira.atlassian.com/browse/STASH-3005

how big are chances of getting it in Stash 2.1?

Jason Hinch Atlassian Team Jan 20, 2013

For 2.1 basically zero chance (it is due in a little over a week). I probably should have been clearer that it isn't a bug that you are unable to create an author but rather an intentional limitation. One issue is that of permissioning. Who should be allowed you create a pull request on a users behalf?

I've created a feature request for you to share your use case, provide suggestions and to vote on: https://jira.atlassian.com/browse/STASH-3005

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Jun 12, 2018 in Bitbucket

Do you use any Atlassian products for your personal projects?

After spinning my wheels trying to get organized enough to write a book for National Novel Writing Month (NaNoWriMo) I took my affinity for Atlassian products from my work life and decided to tr...

22,739 views 26 12
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you