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

approveman does not support deviating appname #64

Closed
epDHowwD opened this issue Sep 10, 2020 · 6 comments · Fixed by #69
Closed

approveman does not support deviating appname #64

epDHowwD opened this issue Sep 10, 2020 · 6 comments · Fixed by #69
Labels
bug Something isn't working

Comments

@epDHowwD
Copy link

I built and installed this app on a GitHub enterprise server and prefixed the app name with our project name (as gh enterprise does not scope apps). So then the name of the app (and hence the reviewing "user") was not approveman[bot] as hard coded in the code. Thus, the app was not able to dismiss its own review.

@tianhaoz95
Copy link
Owner

@epDHowwD Ah that's a problem. I wasn't thinking too much about the enterprise initially. Can you post a sample how the naming scheme work in enterprise so that I can fix that in the code.

@tianhaoz95 tianhaoz95 added the bug Something isn't working label Sep 11, 2020
@tianhaoz95
Copy link
Owner

So far I think there are 2 possible solutions:

  1. allow the DIY user to override the app name with APP_NAME_OVERRIDE while building and deployment.
  2. fetch the application name with the self auth in GitHub API.

Also, I do thing they can co-exist.

@tianhaoz95
Copy link
Owner

Yea I think both mechanisms should exist since GitHub enterprise is not listed in marketplace subscription, there is really not way for the app to know what the name is from GitHub. Please let me know if you have other good ideas @epDHowwD

tianhaoz95 added a commit that referenced this issue Sep 12, 2020
This PR adds the feature to override the default app actor name with an environment variable APP_ACTOR_NAME_OVERRIDE which used to be hardcoded to "approveman[bot]".

This is useful for GitHub Enterprise users whose app content name is different from the GitHub marketplace. Before the change, GitHub Enterprise users will have trouble dismissing outdated approvals since the name it searches for is "approveman[bot]" (for details on this problem, see #64 ).

This PR also adds a check so that if a GitHub Enterprise user (inferred from GHE_HOST) deploys the app without setting APP_ACTOR_NAME_OVERRIDE will post a failing status upon any event processed.

This is not ideal because we want to fail the moment the app starts running instead of when an event is received. However, Probot currently doesn't support this kind of health check as far as I know. I have opened an issue for Probot to add this capability into their infra (for details and progress, see probot/probot#1340 ).
@epDHowwD
Copy link
Author

You may try to use the authenticated app endpoint. It returns the configured name, id, avatar, and even the html_url and external_url, which might be interesting for status posts.
I don't now much about probot app development, so it is just a guess.

As we are building the app from source, a central modifiable variable would already do the trick. Also ENV during build-time or runtime would work.

As you asked for examples for our naming schemes, we prefix the apps usually with an organization name separated with -. However, I do not recommend to stick to this in your app.

@tianhaoz95
Copy link
Owner

@epDHowwD Yes I think the get app API is a good next thing to explore. At the same time , the app name can now be configured with APP_ACTOR_NAME_OVERRIDE either in environment or .env which is added in #69

@epDHowwD
Copy link
Author

image
Works as expected and out of the box. Thank you very much @tianhaoz95 !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants