A self-hosted Google Apps Script project that delivers push event details from GitHub to your inbox
push2email
may be used as a self-hosted replacement to the email service that is due to be deprecated on January 31, 2019.
- Setup
- Build
- Deploy
- Authorize
- Configure script properties
- Get your project's webhook URL
- Configure your repository to send
push
event to your project's webhook URL
- Clone this repo
- Install dependencies
npm install
- Install Google's Clasp
npm i @google/clasp -g
,clasp login
- Create a Clasp project
clasp create push2email
npm run-script build
- Push the project:
clasp push
- Deploy the project:
clasp deploy
- Open your project in your browser:
clasp open
- ...
To specify an email address to which push event details will be delivered:
- Open your project in your browser:
clasp open
- Navigate to
File
>Project properties
, select theScript properties
tab - Add a new row, enter
RECIPIENT_EMAIL
as the property, and a valid email address as the value
Once deployed, you can lookup the webhook URL for your project.
Your project's webhook URL is of the form:
https://script.google.com/macros/s/${DEPLOYMENT_ID}/exec
Where ${DEPLOYMENT_ID}
is the ID of a deployment of your project. To look up the deployments with Clasp, run clasp deployments
, this will generate output like the following:
2 Deployments.
- AKfycbw6KfHThp5GkM4PJfvHVSts-8g1jBjtcN-kOYfjyg @HEAD
- AKfycbwOgu_KUrNGOKmyj7oCI2rsZemH9y9PMOcC5tomM_6iibfoUUJ2vM3wZC740X2IzBk @1
So, in this instance, the deployment ID for version 1 (indicated by @1
in the above output) is AKfycbwOgu_KUrNGOKmyj7oCI2rsZemH9y9PMOcC5tomM_6iibfoUUJ2vM3wZC740X2IzBk
. The webhook URL for this deployment, therefore, is https://script.google.com/macros/s/AKfycbx7mw535PmMPqUzXMPCI_0GQ5aLAZfDbqiNSiQAYEWbd2RXLj8LtMMlgu7XHUMnbDg/exec
.
Configure a webhook via your repository's settings page.
- Payload URL is your project's webhook URL
- Content type is
application/json
- Trigger the webhook with just the
push
event - Make sure it's set to active ✅
You're all set, pushes to your repository will now trigger an email to the address you specified 🚀