ontodev / droid

DROID Reminds us that Ordinary Individuals can be Developers
BSD 3-Clause "New" or "Revised" License
4 stars 1 forks source link

Improve logging/messages when DROID is not yet installed as a GitHub App #141

Open jamesaoverton opened 7 months ago

jamesaoverton commented 7 months ago

Today I debugged a problem with @anitacaron where she would click "Push", it would fail, and DROID would print a message to its console saying: 403 permission denied error from GitHub. She has write permissions on that GitHub repository, and was able to push commits using other tools. DROID was showing the version control buttons, so I think DROID was correctly reading her repository write permissions from GitHub. I think the cause is that her DROID GitHub App was not "installed" on that GitHub repository.

The DROID README has thorough documentation on the confusing process of setting up a GitHub App. It's easy to do that once and forget about it. But when a new project is added to DROID, DROID needs to be "installed" into that GitHub organization and/or repository. This can be easy to forget.

I think that DROID should be able to detect that it's not "installed". If it isn't installed, it should not display the list of branches or branch pages. It should just display a message with instructions for installing the GitHub App.

@lmcmicu Does my reasoning make sense to you?

lmcmicu commented 7 months ago

Regarding DROID being able to detect whether an app has been installed to a given project, it seems that some checks are being done in the function get-github-app-installation-token() so I am not sure why these error messages are not appearing in the log and/or console. If these are not being generated, then we should look into that. Note that function is called every time that remote branches are refreshed (which happens in response to various events). It is also called at branch creation and whenever commits are pushed.

Assuming that we can successfully detect when a GitHub app is not installed and write the appropriate message to the log/console, then we should be able to detect the lack of an installation token somewhere around here, by (for instance) checking to see if password is empty, and only display the project's branches if it is not, or otherwise display some instructions.