getsentry / sentry-github-actions-app

This app allows your organization to instrument Github Actions with Sentry. You can use this to get insight of what parts of your CI are slow or failing often
MIT License
18 stars 8 forks source link

Support Github app #27

Closed armenzg closed 1 year ago

armenzg commented 2 years ago

The app is currently set up to use a Github webhook and a token.

Currently, the app can be set up with:

The usage of the tokens from either option has the security risk of the token being stolen from the app. Using a Github app approach increases the security and allows external customers to easily install it on their Github orgs. The Github app can request webhook access and security permissions (read from workflows APIs for public and private repos).

armenzg commented 2 years ago

Under my new org I followed these steps to create a new app.

-> https://github.com/organizations/armenzg-dev/settings/apps

I've given it Actions permissions (read-only):

image

I've set a Webhook URL (to our current deployment) and a secret:

image

Because of the given permission I need to select a subset. I've chosen "Workflow job" because I already have it working with it.

image

For now, I have restricted it to this account:

image

I do not know if any of these need to be set:

image
armenzg commented 2 years ago

I'm asked to generate a private key for the app

image

It seems the private key gets downloaded to my machine.

From the docs:

To authenticate as a GitHub App, generate a private key in PEM format and download it to your local machine. You'll use this key to sign a JSON Web Token (JWT) and encode it using the RS256 algorithm. GitHub checks that the request is authenticated by verifying the token with the app's stored public key.

armenzg commented 2 years ago

I've installed it to the org:

image
armenzg commented 2 years ago

Landed code for this: https://github.com/getsentry/sentry-github-actions-app/pull/32

armenzg commented 2 years ago

I need to transfer the org to getsentry and enable the Github App mode by adding the GH_APP_ID as env variable.

armenzg commented 1 year ago

This got done ages ago.