Automatically create PR for dependent submodule update.
Currently works for Bitbucket and all repositories under one project only.
The approach is to setup a Merge
event webhook in the submodule's Bitbucket repository, e.g.
- Repo
A
andB
are in Bitbucket projectP
- Repo
A
is a submodule of repoB
- Merge event happens in repo
A
- Bitbucket sends a webhook event to this
submodule-bot
(hosted somewhere, there is a docker build file) submodule-bot
scans the project's repositories for the submodule dependencies in projectP
submodule-bot
creates a PR in repoB
for repoA
's update.
// ENVs required
GIT_USER_NAME
GIT_USER_EMAIL
BITBUCKET_USERNAME
BITBUCKET_PASSWORD
// GPG signing commits for your bot's commit
SUBMODULE_BOT_PRIVATE_KEY_ID
SUBMODULE_BOT_PRIVATE_KEY
// Install
npm install
// Run
node server.js
// Make sure those ENVs are set on the build shell
docker build --build-arg SUBMODULE_BOT_PRIVATE_KEY --build-arg SUBMODULE_BOT_PRIVATE_KEY_ID --build-arg GIT_USER_NAME --build-arg GIT_USER_EMAIL --build-arg BITBUCKET_USERNAME --build-arg BITBUCKET_PASSWORD -t ad/submodule-bot .