probot / adapter-aws-lambda-serverless

An extension for running Probot on Lambda
ISC License
94 stars 36 forks source link

Provide GitHub Authentication variables programatically #54

Closed swain closed 3 years ago

swain commented 3 years ago

Is there any plan to support providing GitHub credential information (APP_ID, WEBHOOK_SECRET, PRIVATE_KEY) without environment variables?

For example, something like:

const { serverless } = require('@probot/serverless-lamda');

module.exports.probot = serverless({
  app: myAppFn,
  getAuthentication: () => {
     // retrieve values, and return e.g.
    return { appId, privateKey, webhookSecret };
  }
})

Thanks!

gr2m commented 3 years ago

Yes! The latest Probot ships with new APIs that should make it easier to use in serverless/function environments. This is how the APIs look like:

https://probot.github.io/docs/serverless-deployment/#deploy-the-app

What that work for you?

The timing of your question is great! I'm looking for someone to help create an example repository for an AWS Lambda deployment, similar to https://github.com/probot/example-google-cloud-function. Would you like to help with that? I wonder what the most minimal setup would be to (continuously) deploy a Probot app function to AWS Lambda. I wonder if we need the serverless framework or if there is a simpler way without the extra tooling?

Probot
Serverless deployment
GitHub Apps to automate and improve your workflow
GitHub
probot/example-google-cloud-function
Probot & Google Cloud Functions example. Contribute to probot/example-google-cloud-function development by creating an account on GitHub.
gr2m commented 3 years ago

It will be possible via https://github.com/probot/adapter-aws-lambda-serverless/pull/59

using environment variables:

const { createLambdaFunction, createProbot } = require("@probot/adapter-aws-lambda-serverless");
const appFn = require("./");
module.exports.webhooks = createLambdaFunction(appFn, { probot: createProbot() });

programmatic

const { createLambdaFunction, Probot } = require("@probot/adapter-aws-lambda-serverless");
const appFn = require("./");
module.exports.webhooks = createLambdaFunction(appFn, { 
  probot: new Probot({
    // pass whatever options you like
    appId,
    privateKey,
    secret,
  })
});
github-actions[bot] commented 3 years ago

:tada: This issue has been resolved in version 2.0.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: