Skip to content

Commit

Permalink
Comment possibly-confusing logic
Browse files Browse the repository at this point in the history
  • Loading branch information
pbrisbin committed Sep 26, 2024
1 parent 612f5df commit d0acc7e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/GitHub/App/Token/Generate.hs
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,12 @@ generateOwnerTokenScoped
-> Owner
-> m AccessToken
generateOwnerTokenScoped create creds owner = do
-- If a repositories scope is given, use the first one (along with owner) to
-- get the installation. Otherwise use the org or user endpoint. This matches
-- how actions/create-github-app-token works:
--
-- https://github.com/actions/create-github-app-token/blob/5d869da34e18e7287c1daad50e0b8ea0f506ce69/lib/main.js#L113-L166
--
installation <- getInstallation creds $ case (create.repositories, owner) of
(repo : _, Org org) -> "/repos/" <> org <> "/" <> repo
(repo : _, User username) -> "/repos/" <> username <> "/" <> repo
Expand Down

0 comments on commit d0acc7e

Please sign in to comment.