A tool that deletes Bitbucket pipeline build steps that are now obsolete and opens a PR in the given repo.
This tool requires 3 things to be done before being able to run the script.
To install this script's dependencies, run the following command:
pip install -r requirements.txt
As this tool requires authentication to connect to the Bitbucket API, you will need to set 2 environment variables:
- BB_USER_ID
- BB_APP_PASS
Finally, this tool requires a JSON formatted configuration file. By default, it assumes the filepath to
be ./config.json
, but this can be changed using the -c
argument.
The config file should be structured as follows:
{
"workspace": "<string>",
"repositories": [
"<string>"
],
"steps": [
{
"name": "<string>",
"files": [
"<string>"
]
}
],
"reviewers": [
{
"account_id": "<string>"
}
]
}
Use the following endpoint, replacing all values where needed, to find the account ids of each reviewer:
https://bitbucket.org/!api/2.0/workspaces/<workspace_name>/members
- Refactor to utilize asyncio
- Use regex when finding build steps for deletion
- Add method of dynamically retrieving reviewer account ids
- Modify logic to create only one PR per repository if multiple steps are being removed