A tool to help developers to ensure that their PRs are up-to-date with master branch 🤖
MIT License
To enable the bot to create pull request comments and access repositories, we need to create a Github personal access token. If the bot will operate on public repositories, the token should have the scope public_repo
. If the bot will also operate on private repositories, the token should have the scope repo
.
First, install the dependencies. Follow the instructions under the "before you begin" section here:
Next, create the GCP resources and deploy the bot:
yarn install --prod
gcloud functions deploy GcpGithubWebhook --runtime nodejs10 --trigger-http --set-env-vars GITHUB_WEBHOOK_SECRET=<secret>,GITHUB_TOKEN=<token>,TOPIC_NAME=webhookqueue
gcloud functions deploy GcpWebhookWorker --trigger-topic webhookqueue --runtime nodejs10 --set-env-vars GITHUB_TOKEN=<token>,SLACK_TOKEN=<token>,SLACK_WEBHOOK_URL=<url>
The bot will be available at the URL https://<region>-<name>.cloudfunctions.net/GcpGithubWebhook
First, install the dependencies:
Next, create the Azure resources:
az group create --location <location> --name <name>
az group deployment create --resource-group <name> --template-file azuredeploy.json --parameters appName=<name> GITHUB_TOKEN=<token> GITHUB_WEBHOOK_SECRET=<secret> SLACK_TOKEN=<token> SLACK_WEBHOOK_URL=<url>
func azure functionapp fetch-app-settings <name>
Then, deploy the bot:
yarn install --prod
func azure functionapp publish <name>
The bot will be available at the URL https://<name>.azurewebsites.net/api/AzGithubWebhook
curl 'https://api.github.com/repos/<organization>/<repository>/hooks' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <token>' \
-d '
{
"name": "web",
"active": true,
"events": [
"push",
"pull_request"
],
"config": {
"url": "<url>",
"secret": "<secret>",
"content_type": "json",
"insecure_ssl": "0"
}
}
'
This project uses the following static analysis tools:
yarn run lint
runs the standard linter
yarn run typecheck
runs the Typescript compiler