Skip to content

Commit

Permalink
feat: probot-beta.v23 - the pino edition (#245)
Browse files Browse the repository at this point in the history
Probot dropped built-in support for sending errors to sentry, we now have to use external `pino-*` transport libraries instead
  • Loading branch information
gr2m authored Aug 12, 2020
1 parent 9754d89 commit a9a07a9
Show file tree
Hide file tree
Showing 11 changed files with 800 additions and 405 deletions.
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ WEBHOOK_SECRET=
APP_NAME=

# (optional) Logging with LogDNA
LOGDNA_API_KEY=
LOGDNA_KEY=

# (optional) Sending exceptions to Sentry
SENTRY_DSN=
27 changes: 0 additions & 27 deletions .travis.yml

This file was deleted.

61 changes: 0 additions & 61 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,67 +34,6 @@ If you run into a problem with the app, please create an issue describing how to

Note that the WIP is simple by design. I’m sure there are plenty of features that could be added with just a little bit of code. But in most cases we probably won’t add it to the WIP itself. But please suggest it anyway, we can have a discussion and maybe you can create your own application with additional features and WIP some users might be interested in using it instead of WIP. I’d be happy to mention your app in the README.md once we have a few "forks" that are worth mentioning.

## Maintainers: deploying WIP (Beta)

1. Update `now.json`

```diff
diff --git a/now.json b/now.json
index c28efe9..b66fc35 100644
--- a/now.json
+++ b/now.json
@@ -1,6 +1,6 @@
{
- "name": "wip",
- "alias": "wip",
+ "name": "wip-beta",
+ "alias": "wip-beta",
"scale": {
"all": {
"min": 1,
@@ -8,14 +8,14 @@
}
},
"env": {
- "APP_ID": "@app-id",
- "APP_NAME": "WIP",
+ "APP_ID": "@beta-app-id",
+ "APP_NAME": "WIP (beta)",
"DISABLE_STATS": "true",
- "LOG_LEVEL": "@log-level",
+ "LOG_LEVEL": "@beta-log-level",
"LOGDNA_API_KEY": "@logdna-api-key",
"NODE_ENV": "production",
- "PRIVATE_KEY": "@private-key",
+ "PRIVATE_KEY": "@beta-private-key",
"REDIS_URL": "@redis-url",
"SENTRY_DSN": "@sentry-dsn",
- "WEBHOOK_SECRET": "@webhook-secret"
+ "WEBHOOK_SECRET": "@beta-webhook-secret"
}
}
```

2. Update `deploy.sh` if you plan to continously deploy from GitHub. Not needed when only deploying locally

```diff
diff --git a/scripts/deploy.sh b/scripts/deploy.sh
index a70ffa9..ae50b8f 100755
--- a/scripts/deploy.sh
+++ b/scripts/deploy.sh
@@ -3,8 +3,8 @@ set -e

now="npx now --debug --token=$NOW_TOKEN"

-echo "$ now rm --safe --yes wip"
-$now rm --safe --yes wip
+echo "$ now rm --safe --yes wip-beta"
+$now rm --safe --yes wip-beta

# https://github.com/zeit/now-cli/blob/master/errors/verification-timeout.md
echo "$ now --no-verify"
```

## Resources

- [How to Contribute to Open Source](https://opensource.guide/how-to-contribute/)
Expand Down
1 change: 1 addition & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: ./node_modules/.bin/probot run ./index.js | ./node_modules/.bin/pino-sentry | ./node_modules/.bin/pino-logdna
2 changes: 0 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
module.exports = wip;

const sendLogs = require("./lib/logs/send");
const logMemoryUsage = require("./lib/logs/memory-usage.js");
const handlePullRequestChange = require("./lib/handle-pull-request-change");
const handleMarketplacePurchase = require("./lib/handle-marketplace-purchase");
Expand Down Expand Up @@ -35,6 +34,5 @@ function wip(app) {
handleInstallation.bind(null, app)
);

sendLogs(app);
logMemoryUsage(app);
}
17 changes: 0 additions & 17 deletions lib/logs/send.js

This file was deleted.

2 changes: 1 addition & 1 deletion now.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"APP_NAME": "WIP",
"DISABLE_STATS": "true",
"LOG_LEVEL": "fatal",
"LOGDNA_API_KEY": "@logdna-api-key",
"LOGDNA_KEY": "@logdna-key",
"NODE_ENV": "production",
"PRIVATE_KEY": "@private-key",
"REDIS_URL": "@redis-url",
Expand Down
Loading

3 comments on commit a9a07a9

@BelleDawn
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no idea what I am doing here but I am not going back into the past

@BelleDawn
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FB_IMG_1603651334780

@BelleDawn
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.