eddies / github-webhook-cloud-function Goto Github PK
View Code? Open in Web Editor NEWA Google Cloud Function for GitHub Webhooks
License: ISC License
A Google Cloud Function for GitHub Webhooks
License: ISC License
Consider refactoring our so-called "handler" to actually be an event handler.
The API calls to Trello for getBoardId
and getCustomFields
should be memoized to avoid making more HTTP requests than necessary.
We presently support branch names that lead with the trello card id immediately followed by a forward slash, e.g. nqPiDKmw/9-grand-canyon-national-park
.
This is inconvenient in a day-to-day command-line workflow. It requires developers to remember the card id when switching branches, e.g. git checkout nqPiDKmw/9-grand-canyon-national-park
. It would be preferable if the card id was at the end of the branch name, e.g. grand-canyon-national-park#nqPiDKmw
(or with some other separator). This would allow developers to switch/checkout branches without having to remember the card id.
All of the logic for parsing the branch name for the card id is isolated to getShortLink
Might need to rename this project to something like github-webhook-serverless or serverless-github-webhook.
#20 changed the behavior of the cloud function to require the Trello card id at the end of the branch name, e.g. grand-canyon-national-park#nqPiDKmw
.
The previous behavior expected the Trello card id at the beginning, e.g. nqPiDKmw/9-grand-canyon-national-park
(which mapped neatly onto the latter part of the Trello card url).
Either style of branch naming should be allowed.
Cloud Functions log console.log
and console.error
to Stackdriver. Presently, the only log messages in Stackdriver are:
which includes no detail about the client, request, etc.
github-webhook-cloud-function should output more log messages.
When a branch is force pushed, the Trello comment should indicate that the push was forced, e.g.
josh force pushed ...
instead of the current josh pushed ...
Update eslint-config-airbnb (v13.1.0 introduces support for eslint 5) and other outdated devDependencies
Update eslint, eslint-plugin-import and jest:
Package Current Latest
eslint 5.4.0 5.14.0
eslint-plugin-import 2.14.0 2.16.0
jest 23.5.0 24.1.0
Use Trello's Custom Fields to indicate PR status on a card.
Currently, github-webhook-cloud-function adds an attachment URL to a Trello card when a PR is opened. It would be great if the front of the card could indicate the PR status: open, closed or merged.
Labels could be used as an indicator, but by default, you only see the label color, so you would have to know what color meant what, even more problematic if you were already using the label color for something else.
A Custom Fields of type list, could have three options: open, closed and merged, and each can have a color assigned.
Per https://cloud.google.com/functions/docs/bestpractices/networking, we should
...maintain persistent connections in a function. Failure to do so can result in quickly exhausting connection quotas
and provides an example of using http.Agent({keepAlive: true})
to "maintain persistent connections instead of creating a new connection upon every function invocation".
(I'm not sure if the second link applies, in which case we may run into issues if we implement this)
pull_request
events with action opened
can result in multiple API calls to Trello, e.g.:
If the Custom Fields Power-Up is not enabled for a board, the POST Custom Field will fail with a 403 Forbidden.
If the board has a Custom Field named 'PR' but is missing one of 'Open', 'Closed' or 'Merged' list options, the PUT will fail with a 500.
So, the attachment URL could succeed but one or more of the subsequent operations could fail. One way to handle this in the response is to return an HTTP 207 Multi-Status.
Alternatively, we could use a 200 with a better response body. Presently, however, we're returning 200s for events that we are not supporting (but doesn't represent an error), e.g. a pull_request event with action 'labeled'. Because we use a different status code (201) for events we do support, it's easy to distinguish the two when parsing logs on GCP and Webhook results from GitHub.
Instead of returning a 401, we should return a 403.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.