Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide GitHub Authentication variables programatically #54

Closed
swain opened this issue Dec 10, 2020 · 3 comments · Fixed by #59
Closed

Provide GitHub Authentication variables programatically #54

swain opened this issue Dec 10, 2020 · 3 comments · Fixed by #59
Labels

Comments

@swain
Copy link
Contributor

swain commented Dec 10, 2020

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
Copy link
Contributor

gr2m commented Dec 10, 2020

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
GitHub Apps to automate and improve your workflow
GitHub
Probot & Google Cloud Functions example. Contribute to probot/example-google-cloud-function development by creating an account on GitHub.

@gr2m
Copy link
Contributor

gr2m commented Feb 9, 2021

It will be possible via #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,
  })
});

@gr2m gr2m mentioned this issue Feb 9, 2021
@gr2m gr2m closed this as completed in #59 Feb 10, 2021
@github-actions
Copy link

🎉 This issue has been resolved in version 2.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants