trigger an action when repo is forked?

Max DeCurtins July 8, 2022

I would like to trigger an action when a repo is forked, e.g. when I fork Repo A, I would like to trigger a change to the repository settings on the fork, Repo B.

For example, Bitbucket currently (and very wrongly) assumes that PRs in repos that were forked from an upstream, should target the upstream by default. There is currently no way to change this.

Since there is no way to change this and no merge check available based on the target repo, my workaround is to create a default pull request task on PRs that basically says "CHECK THE TARGET REPO" and then have a merge check for unresolved PR tasks.

What I'd like to do is to have this default pull request task created (and the corresponding merge check enabled) every time the upstream repo is forked.

Better yet, is there a way to create a set of repository settings that is automatically applied to each repo that is forked from the upstream?

1 answer

0 votes
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 12, 2022

Hi Max,

You could use a webhook with trigger Repository : Fork for this purpose. With such a webhook, Bitbucket will send a request to a server of yours every time the repo is forked, and you can then run an API call on your server in order to update certain settings of the fork repo.

This is possible for settings that can be updated via our API. E.g. it is possible to create branch permissions via API:

However, I'm afraid that it is not possible to create default tasks via API. We have a feature request for providing an API for PR tasks: https://jira.atlassian.com/browse/BCLOUD-16682 Until this is implemented, default tasks need to be created manually from the Repository settings.

We also have a feature request for allowing users to set the default target repository for forks https://jira.atlassian.com/browse/BCLOUD-20010 I would encourage you to add your vote and feedback to that feature request if that's something you'd be interested in, as this helps our product managers better understand the demand for features.

Kind regards,
Theodora

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events