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

Make bedevere work as a GitHub App #569

Merged
merged 1 commit into from
Sep 11, 2023
Merged

Make bedevere work as a GitHub App #569

merged 1 commit into from
Sep 11, 2023

Conversation

Mariatta
Copy link
Member

@Mariatta Mariatta commented Jun 14, 2023

Instead of using Oauth Token, use the GitHub App Installation Access Token. If the "installation" dict is passed in the webhook event, use it.

Made some changes to accommodate testing in personal CPython fork.

Checklist for deploying this app:

  • Choose a name for the GitHub App. (Can't use bedevere-bot since it's already taken). Suggestions: bedevere-py, bedevere-app
  • Create a GitHub App under the Python org / transfer mariatta's app to the Python org
  • Set environment variables in bedevere's Heroku app: GH_APP_ID, GH_PRIVATE_KEY (from the newly created GitHub App in the previous step)
  • Deploy and test

@Mariatta
Copy link
Member Author

I tested the app by deploying it to a personal heroku instance, and created a GitHub App on my account.
Sample how it works: Mariatta/cpython#77

It shows the bot applying the "skip news" and "docs" labels to the PR.
Since it is a personal App, it does not have access to the CPython core devs list, and therefore it applies the "awaiting review" label. (It doesn't know that I'm a core developer).

@codecov
Copy link

codecov bot commented Jun 14, 2023

Codecov Report

Merging #569 (de3b489) into main (249bab5) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##              main      #569   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           18        18           
  Lines         2088      2133   +45     
  Branches       237       245    +8     
=========================================
+ Hits          2088      2133   +45     
Flag Coverage Δ
Python_3.10.12 ?
Python_3.10.13 100.00% <100.00%> (?)
Python_3.11.4 ?
Python_3.11.5 100.00% <100.00%> (?)
Python_3.8.17 ?
Python_3.8.18 100.00% <100.00%> (?)
Python_3.9.17 ?
Python_3.9.18 100.00% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
bedevere/__main__.py 100.00% <100.00%> (ø)
bedevere/stage.py 100.00% <100.00%> (ø)
bedevere/util.py 100.00% <100.00%> (ø)
tests/test___main__.py 100.00% <100.00%> (ø)
tests/test_stage.py 100.00% <100.00%> (ø)
tests/test_util.py 100.00% <100.00%> (ø)

@Mariatta Mariatta marked this pull request as ready for review June 14, 2023 19:20
@AlexWaygood AlexWaygood changed the title Make bedeverw works as a GitHub App Make bedevere works as a GitHub App Jun 14, 2023
@Mariatta Mariatta mentioned this pull request Jun 14, 2023
@AlexWaygood AlexWaygood changed the title Make bedevere works as a GitHub App Make bedevere work as a GitHub App Jun 14, 2023
@Mariatta Mariatta closed this Jun 15, 2023
@Mariatta Mariatta reopened this Jun 15, 2023
@arhadthedev arhadthedev mentioned this pull request Jun 15, 2023
@ewdurbin ewdurbin self-assigned this Jun 15, 2023
@hugovk
Copy link
Member

hugovk commented Jun 16, 2023

  • Choose a name for the GitHub App. (Can't use bedevere-bot since it's already taken). Suggestions: bedevere-py, bedevere-app

bedevere-app sounds good: it's a GitHub app, so it's descriptive. bedevere-py could be almost anything.

Copy link

@picnic-sven picnic-sven left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Super small review. Exciting feature ✨ !

bedevere/util.py Show resolved Hide resolved
Instead of using Oauth Token, use the GitHub App Installation Access Token.
If the "installation" dict is passed in the webhook event, use it.

Made some changes to accommodate testing in personal CPython fork.
@Mariatta
Copy link
Member Author

Mariatta commented Sep 8, 2023

@ewdurbin checking if you've had chance to review this. Thanks.

@ewdurbin
Copy link
Member

ewdurbin commented Sep 9, 2023

Hi @Mariatta this looks ready to go. I think I'd prefer us to create a new GitHub application under the python org.

What permission requests need to be configured for the application to work?

@Mariatta
Copy link
Member Author

Mariatta commented Sep 9, 2023

These are the settings I have on my test app:

General:

  • Webhook: active
  • Webhook URL: the url to bedevere's Heroku app
  • Webhook Secret: the GH_SECRET env var in Heroku

SSL verification:

  • enable

Repository permissions:

  • Commit statuses: Read and write
  • Issues: Read and write
  • Metadata: Readonly
  • Pull requests: read and write
  • the rest are no access (default)

Organization permissions:

  • no access

Account permissions:

  • no access

Subscribe to events

  • Issues
  • Pull request
  • Repository
  • Pull Request Review

Let me know if there's anything else needed, and also give me heads up when this is set up. I can help debug issues in case anything arises.

@ewdurbin
Copy link
Member

OK @Mariatta everything is set. The app has been created. I'm going to see if we can make it work :)

@ewdurbin ewdurbin merged commit 9010a0f into python:main Sep 11, 2023
7 checks passed
@ewdurbin
Copy link
Member

OK, the app has been installed on the cpython repository and the web hook set to inactive.

@ewdurbin
Copy link
Member

Looks like it's working! python/cpython#109264 :)

@ewdurbin
Copy link
Member

Thanks @Mariatta!

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

Successfully merging this pull request may close these issues.

None yet

4 participants