Skip to content

Commit

Permalink
Fix docs repositories scope documentation
Browse files Browse the repository at this point in the history
The `repositories` element is names, not full `owner/name`s.
  • Loading branch information
pbrisbin committed Oct 1, 2024
1 parent d0acc7e commit 2478329
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
11 changes: 10 additions & 1 deletion README.lhs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ getScopedAppToken = do
let
creds = AppCredentials {appId, privateKey}
create = mempty
{ repositories = ["freckle/github-app-token"]
{ repositories = ["github-app-token"]
, permissions = contents Read
}
Expand Down Expand Up @@ -141,6 +141,15 @@ main = do
, description = "Generate an installation token for a GitHub App"
}
Hspec.describe "Scoped usage" $ do
Hspec.it "works" $ do
token <- getScopedAppToken
getRepo token "freckle/github-app-token"
`Hspec.shouldReturn` Repo
{ name = "github-app-token"
, description = "Generate an installation token for a GitHub App"
}
Hspec.describe "By owner" $ do
Hspec.it "works" $ do
token <- getOwnerAppToken
Expand Down
4 changes: 3 additions & 1 deletion src/GitHub/App/Token/Generate.hs
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,11 @@ generateOwnerToken = generateOwnerTokenScoped mempty
-- | <https://docs.github.com/en/rest/apps/apps?apiVersion=2022-11-28#create-an-installation-access-token-for-an-app>
data CreateAccessToken = CreateAccessToken
{ repositories :: [Text]
-- ^ List of @{owner}/{name}@ values
-- ^ List of repository names that the token should have access to
, repository_ids :: [Int]
-- ^ List of repository IDs that the token should have access to
, permissions :: Permissions
-- ^ The permissions granted to the user access token
}
deriving stock (Eq, Generic)
deriving anyclass (ToJSON)
Expand Down

0 comments on commit 2478329

Please sign in to comment.