-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathdune
47 lines (43 loc) · 1.46 KB
/
dune
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
(library
(name Bot_components)
(public_name bot-components)
(libraries base camlzip cohttp-lwt-unix eqaf ohex mirage-crypto stdio str
x509 yojson ISO8601 digestif)
(private_modules GraphQL_query GitHub_GraphQL Utils)
(modules_without_implementation GitHub_types GitLab_types)
(preprocess
(per_module
((pps graphql_ppx -- -native -schema bot-components/github-schema.json)
GitHub_GraphQL)
((pps graphql_ppx -- -native -schema bot-components/gitlab-schema.json)
GitLab_GraphQL)))
(preprocessor_deps
(file github-schema.json)
(file gitlab-schema.json)))
(rule
(targets gitlab-schema.json)
(deps (universe))
(action
(with-stdout-to
%{targets}
(run get-graphql-schema https://gitlab.com/api/graphql --json)))
(mode promote))
; This rule needs access to the user's Private Access Token for github
; (see: https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token)
; The token should be stored in .github-token in the same directory as this dune file
; A schema.json file will be created containing the graphql schema for github
;
; `read-strings` is preferred to read since it won't read the newline
(rule
(targets github-schema.json)
(deps .github-token (universe))
(action
(with-stdout-to
%{targets}
(run get-graphql-schema --json --header
"Authorization=Bearer %{read-strings:.github-token}"
https://api.github.com/graphql)))
(mode promote))
(env
(dev
(flags :standard -w -9)))