-
Notifications
You must be signed in to change notification settings - Fork 145
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: upgrade to Probot v10 / deploy to Vercel (#330)
Basically a rewrite, but plenty of code has been reused from previous contributors Co-authored-by: Frederick Fogerty <frederick.fogerty@gmail.com> Co-authored-by: Jake Bolam <jake.bolam@gmail.com> Co-authored-by: Jeff Wen <sinchangwen@gmail.com> Co-authored-by: Jérémie Astor <astor.jeremie@wanadoo.fr> Co-authored-by: Kyle Martin <kyle.martin@hotmail.co.nz> Co-authored-by: Maximilian Berkmann <maxieberkmann@gmail.com> Co-authored-by: Michael Fix <mrfix84@gmail.com> Co-authored-by: mralwin <owendthiele@gmail.com> Co-authored-by: Nicolas Goutay <phacks@users.noreply.github.com> Co-authored-by: Owen Thiele <owendthiele@gmail.com> Co-authored-by: Pierre Grimaud <grimaud.pierre@gmail.com> Co-authored-by: Sang Lostrie <sang.lostrie@gmail.com> Co-authored-by: Stefano Moia <s.moia@bcbl.eu>
- Loading branch information
1 parent
31fd74b
commit 8a3f99d
Showing
107 changed files
with
16,746 additions
and
12,411 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: Test | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
pull_request: | ||
types: | ||
- opened | ||
- synchronize | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v2 | ||
- run: npm ci | ||
- run: npm test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
# Contributing | ||
|
||
If you're interested in helping out, come join us on [Slack](https://join.slack.com/t/all-contributors/shared_invite/enQtNTE3ODMyMTA4NTk0LTUwZDMxZGZkMmViMzYzYzk2YTM2NjRkZGM5Yzc0ZTc5NmYzNWY3Y2Q0ZTY3ZmFhZDgyY2E3ZmIzNWQwMTUxZmE) for help getting-started [![Chat on Slack](https://img.shields.io/badge/slack-join-ff69b4.svg)](https://join.slack.com/t/all-contributors/shared_invite/enQtNTE3ODMyMTA4NTk0LTUwZDMxZGZkMmViMzYzYzk2YTM2NjRkZGM5Yzc0ZTc5NmYzNWY3Y2Q0ZTY3ZmFhZDgyY2E3ZmIzNWQwMTUxZmE) | ||
|
||
For issues to work on, [see the issues tab](https://github.com/all-contributors/all-contributors-bot/issues) | ||
|
||
## Resources: | ||
|
||
- [Bot Architecture](contributing/bot-architecture.md) | ||
- [Run bot locally](contributing/run-bot-locally.md) | ||
- [Working with forks](contributing/working-with-forks.md) | ||
- [Production: Deployments & Monitoring](contributing/deployments-and-monitoring.md) | ||
- [Production: Deployments & Monitoring](contributing/deployments-and-monitoring.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
const { createNodeMiddleware, createProbot } = require("probot"); | ||
|
||
const app = require("../../app"); | ||
This comment has been minimized.
Sorry, something went wrong. |
||
const probot = createProbot({ | ||
overrides: { | ||
// override default "/" path | ||
webhookPath: "/api/github/webhooks", | ||
}, | ||
}); | ||
|
||
module.exports = createNodeMiddleware(app, { probot }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
const isMessageByApp = require("./lib/is-message-by-app"); | ||
const isMessageForApp = require("./lib/is-message-for-app"); | ||
const CommentReply = require("./lib/modules/comment-reply"); | ||
const processIssueComment = require("./lib/process-issue-comment"); | ||
const { AllContributorBotError } = require("./lib/modules/errors"); | ||
|
||
/** | ||
* @param {import('probot').Probot} app | ||
*/ | ||
module.exports = (app) => { | ||
app.on("issue_comment.created", async (context) => { | ||
if (isMessageByApp(context)) return; | ||
if (!isMessageForApp(context)) return; | ||
|
||
// process comment and reply | ||
const commentReply = new CommentReply(context); | ||
try { | ||
await processIssueComment({ context, commentReply }); | ||
} catch (error) { | ||
const isKnownError = error instanceof AllContributorBotError; | ||
if (!isKnownError) { | ||
commentReply.reply( | ||
`We had trouble processing your request. Please try again later.` | ||
); | ||
|
||
throw error; | ||
} | ||
|
||
context.log.info({ isKnownError, error: error.name }, error.message); | ||
commentReply.reply(error.message); | ||
} finally { | ||
await commentReply.send(); | ||
} | ||
}); | ||
|
||
app.on( | ||
["installation", "installation_repositories"], | ||
async ({ name, payload, log }) => { | ||
const { | ||
action, | ||
repositories, | ||
repositories_added, | ||
repositories_removed, | ||
installation, | ||
} = payload; | ||
|
||
const repositoriesChange = | ||
action === "created" | ||
? repositories.length | ||
: action === "deleted" | ||
? -repositories.length | ||
: repositories_added | ||
? repositories_added.length - repositories_removed.length | ||
: 0; | ||
|
||
const meta = { | ||
event: name, | ||
action, | ||
account: installation.account.id, | ||
accountType: installation.account.type.toLowerCase(), | ||
accountLogin: installation.account.login, | ||
installation: installation.id, | ||
selection: installation.repository_selection, | ||
repositoriesChange, | ||
}; | ||
log.info(meta, `${meta.accountLogin}: ${name} ${action}`); | ||
} | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,16 @@ | ||
# Production: Deployments & Monitoring | ||
|
||
## Deployments | ||
|
||
There is a sandbox environment: | ||
https://github.com/all-contributors-sandbox | ||
|
||
|
||
## Monitoring: | ||
|
||
- [Thundra](https://console.thundra.io/functions/) | ||
- [Sentry](https://sentry.io/all-contributors/github-bot/) | ||
- [AWS Dashboard](https://console.aws.amazon.com/cloudwatch/home?region=us-east-1#dashboards:name=All-Contributors-Bot) | ||
- [AWS Lambda](https://console.aws.amazon.com/lambda/home?region=us-east-1#/functions/all-contributors-bot-prod-githubWebhook?tab=monitoring) | ||
- [Bot Stats](https://gkioebvccg.execute-api.us-east-1.amazonaws.com/prod/probot/stats) | ||
- [Analytics](https://analytics.amplitude.com/all-contributors) | ||
- Coming Soon [All Contributors Usage Stats](d) | ||
- Coming Soon [All Contributors Usage Stats](d) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
# Working with forks: | ||
|
||
## Syncing a fork | ||
|
||
1. `git remote add parent git@github.com:all-contributors/all-contributors-bot.git` | ||
2. `git fetch parent` | ||
3. `git checkout master` or `git checkout empty-contribs` (this branch on your fork) | ||
4. `git merge parent/master` | ||
|
||
See https://help.github.com/articles/syncing-a-fork/ | ||
See https://help.github.com/articles/syncing-a-fork/ |
Oops, something went wrong.
1 comment
on commit 8a3f99d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
trojen