github.com/samcontesse/bitbucket-cascade-merge@v0.0.0-20230227091349-c5ec053235b5/README.md (about)

     1  # Bitbucket Cascade Merge
     2  
     3  Bitbucket Cascade Merge is a service used to automatically cascade changes
     4  after a pull request has been successfully merged (fulfilled). This feature
     5  has not been ported to Bitbucket Cloud.
     6  
     7  More information can be found on the Bitbucket Server
     8  [automatic branch merging](https://confluence.atlassian.com/bitbucketserver/automatic-branch-merging-776639993.html)
     9  documentation. Besides semantic version that is currently not supported, the behaviour tries to be the same.
    10  
    11  You can show you interest and vote for this feature :
    12  [BCLOUD-14286](https://jira.atlassian.com/browse/BCLOUD-14286)
    13  
    14  ## Usage
    15  
    16  ### What do you need ?
    17  
    18  * A service to host this service (eg. Amazon ECS)
    19  * An account on bitbucket.org with r/w privileges to the project
    20  
    21  ### Get an Application Password
    22  
    23  The application password will be used to call the Bitbucket API and fetch/push
    24  the repository.
    25  
    26  1. Open https://bitbucket.org/account/user/{{username}}
    27  2. Go to Access Management > App passwords
    28  3. Click on **Create an app password**
    29  4. Type a **label** and select the following permissions :
    30     * Repositories : Read, Write
    31     * Pull Requests : Read, Write
    32  5. Copy the password somewhere safe, you will need it later to configure
    33     environment variables
    34  
    35  ### Configure a webhook on the repository
    36  
    37  1. Navigate to the repository you want to activate cascade merges
    38  2. Go to Settings > Workflow > Webhooks
    39  3. Click on **Add webhook**
    40  4. Type a title, the url of your container and select
    41     **Choose from a full list of triggers** : Pull Request > Merged
    42  
    43  Security notice: you can use a *token* query parameter in the url field
    44  (eg. `?token=your-random-token`) that needs to match the configured value
    45  of the `TOKEN` environment variable.
    46  
    47  ### Configure the container
    48  
    49  The container can be configured with environment variable.
    50  
    51  | Key                | Default Value | Description                     |
    52  |--------------------|---------------|---------------------------------|
    53  | PORT               | 5000          | Server will listen on this port |
    54  | BITBUCKET_USERNAME |               | Bitbucket username              |
    55  | BITBUCKET_PASSWORD |               | Bitbucket app password          |
    56  | TOKEN              |               | Security token                  |
    57  
    58  
    59  
    60  
    61  
    62  ### Run the container
    63  
    64  Was initially created by [Samuel Contesse](https://github.com/samcontesse).
    65  
    66  
    67  ```
    68  docker run \
    69    -e BITBUCKET_USERNAME=<fillme> -e BITBUCKET_PASSWORD=<fillme> -e TOKEN=<fillme> \
    70    --publish 5000:5000 \
    71    --name bcm \
    72    morpheancloud/bitbucket-cascade-merge
    73  ```
    74  
    75  ## Requirements
    76  
    77  [Libgit2 v1.5.1](https://github.com/libgit2/libgit2/archive/refs/tags/v1.5.1.tar.gz)
    78  must be installed if you do not use the Docker image provided.
    79