This is a script that provides a daily report on unanswered comments in Open Bitbucket PRs.
- Create a Bitbucket Bot User account (You could also use your own user account if comfortable).
- Obtain an app password for the account, select account:read and pull_request:read permissions for your password.
- Add the user to your preferred workspace(s).
- The username and app password obtained form your
BITBUCKET_USERNAME
andBITBUCKET_APP_PASSWORD
respectively.
- Follow the instructions under
Add a bot user
on this link. - Select the Bot Features & Functionality while creating your app.
- Review scopes and add the chat:write scope for your bot under Bot Token Scopes.
- Install to your workspace and obtain the OAuth token given. This forms your
SLACK_TOKEN
- Make sure to add the installed bot to your channel of choice.
- Create a .env file in the same directory as this README using .env.sample as a template.
- Set your
BITBUCKET_USERNAME
: Obtained aboveBITBUCKET_APP_PASSWORD
: Obtained aboveSLACK_TOKEN
: Obtained aboveSLACK_CHANNEL
: Channel name where you want the bot to write updates to.WHEN_TO_RUN
: The time of day when you want the script to run in a HH:MM format. Note that the time usedRUN_IMMEDIATELY
: Set this to anything to disable scheduling and run the script right away (for testing) is local to the server where this script runs. Docker containers are usually timed in UTC+0
- Build and run with docker:
docker build -t bitbotcket:latest . && docker run -it bitbotcket:latest
- By default, the bitbucket bot user will target all repositories in all workspaces it has access to. You can limit the workspaces by setting
the env var
BITBUCKET_WORKSPACES
which is a comma separated list of Workspace IDs. The bot user must have access to these workspaces. - You can also use
REPO_SLUG
to restrict to a specific repo by slug, instead of all repositories. - You can use
PR_MAX_AGE_DAYS
to restrict to pull requests created within the last x days. An integer value is expected. Default is 30.