You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/modules/ROOT/pages/developer-reference.adoc
+39-3Lines changed: 39 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -343,11 +343,41 @@ The injected `DynamicGraphQLClient` instance is authenticated as an installation
343
343
`DynamicGraphQLClient` is a dynamic SmallRye GraphQL client.
344
344
You can find more information about the SmallRye GraphQL client https://quarkus.io/guides/smallrye-graphql-client[here] and https://github.com/smallrye/smallrye-graphql[here].
345
345
346
-
== Configuration Reference
346
+
== Webhook events
347
347
348
-
The Quarkus GitHub App extension exposes the following configuration properties:
348
+
While Quarkus GitHub App was primarily designed as a tool to develop GitHub Apps,
349
+
it is also possible to use it to handle your webhook requests.
349
350
350
-
include::includes/quarkus-github-app.adoc[]
351
+
It will take care of all the ceremony of authenticating the requests and will save you a lot of boilerplate.
352
+
353
+
There are a few differences though:
354
+
355
+
- You will have to use `@RawEvent` to listen to the events and get the raw JSON of the payload.
356
+
- Webhook requests don't provide an installation id so we can't initialize an installation GitHub client nor a GraphQL client.
357
+
358
+
The default `GitHub` REST client instance that can be injected is an application client and has so few permissions that it is not really useful.
359
+
360
+
While it could be a major inconvenience, we present a nice feature dedicated to this use case in the following section.
361
+
362
+
== Providing a personal access token
363
+
364
+
When using Quarkus GitHub App, in most cases, the REST and GraphQL clients provided by the installation are what you are looking for:
365
+
they have the permissions allowed for this GitHub App and it should be enough to do what your GitHub App has been designed for.
366
+
367
+
However, there are corner cases where you might need a client with additional permissions,
368
+
the most common one is when you deal with webhooks as presented in the previous section.
369
+
370
+
For this situation, you can define a personal access token by using the `quarkus.github-app.personal-access-token` configuration property.
371
+
The personal access token provided in this property will be used to initialize:
372
+
373
+
- an authenticated `GitHub` REST client
374
+
- an authenticated `DynamicGraphQL` GraphQL client
375
+
376
+
These clients will be automatically injected in your methods when injecting clients *if the payload doesn't provide an installation id*
377
+
(if it does provide one, the regular installation clients will be injected).
378
+
379
+
It is also possible to directly obtain the clients authenticated with the personal access token by injecting the `TokenGitHubClients` CDI bean.
380
+
It provides methods to get the authenticated REST and GraphQL clients.
351
381
352
382
== Credentials provider
353
383
@@ -389,6 +419,12 @@ public class MyGitHubCustomizer implements GitHubCustomizer {
389
419
}
390
420
----
391
421
422
+
== Configuration Reference
423
+
424
+
The Quarkus GitHub App extension exposes the following configuration properties:
0 commit comments