@useairfoil/producer-github 0.0.0-stage → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/README.md +115 -2
  2. package/dist/index.d.mts +1939 -0
  3. package/dist/index.mjs +3 -0
  4. package/dist/main.d.mts +1 -0
  5. package/dist/main.mjs +698 -0
  6. package/dist/main.mjs.map +1 -0
  7. package/dist/manifest.d.mts +56 -0
  8. package/dist/manifest.mjs +137 -0
  9. package/dist/manifest.mjs.map +1 -0
  10. package/dist/rolldown-runtime-D7D4PA-g.mjs +13 -0
  11. package/dist/src-D6cTmVtF.mjs +1566 -0
  12. package/dist/src-D6cTmVtF.mjs.map +1 -0
  13. package/package.json +48 -4
  14. package/src/client/auth.ts +113 -0
  15. package/src/client/client.ts +192 -0
  16. package/src/client/constants.ts +4 -0
  17. package/src/connector.ts +97 -0
  18. package/src/create-table.ts +5 -0
  19. package/src/demo/changes.ts +420 -0
  20. package/src/demo/index.ts +59 -0
  21. package/src/demo/setup.ts +34 -0
  22. package/src/demo/shared.ts +101 -0
  23. package/src/index.ts +13 -0
  24. package/src/main.ts +22 -0
  25. package/src/manifest.ts +45 -0
  26. package/src/resources/check-runs.ts +72 -0
  27. package/src/resources/commit-statuses.ts +84 -0
  28. package/src/resources/commits.ts +101 -0
  29. package/src/resources/issue-comments.ts +75 -0
  30. package/src/resources/issues.ts +78 -0
  31. package/src/resources/pull-request-commits.ts +91 -0
  32. package/src/resources/pull-request-review-comments.ts +78 -0
  33. package/src/resources/pull-request-reviews.ts +76 -0
  34. package/src/resources/pull-requests.ts +79 -0
  35. package/src/resources/releases.ts +74 -0
  36. package/src/resources/repositories.ts +101 -0
  37. package/src/resources/shared.ts +480 -0
  38. package/src/resources/workflow-jobs.ts +73 -0
  39. package/src/resources/workflow-runs.ts +70 -0
  40. package/src/sandbox.ts +35 -0
  41. package/src/schemas/check-runs.ts +48 -0
  42. package/src/schemas/commit-statuses.ts +31 -0
  43. package/src/schemas/commits.ts +64 -0
  44. package/src/schemas/events.ts +139 -0
  45. package/src/schemas/issue-comments.ts +38 -0
  46. package/src/schemas/issues.ts +62 -0
  47. package/src/schemas/pull-request-commits.ts +28 -0
  48. package/src/schemas/pull-request-review-comments.ts +67 -0
  49. package/src/schemas/pull-request-reviews.ts +37 -0
  50. package/src/schemas/pull-requests.ts +75 -0
  51. package/src/schemas/releases.ts +53 -0
  52. package/src/schemas/repositories.ts +53 -0
  53. package/src/schemas/shared.ts +86 -0
  54. package/src/schemas/workflow-jobs.ts +54 -0
  55. package/src/schemas/workflow-runs.ts +55 -0
  56. package/src/start.ts +47 -0
  57. package/src/tables.ts +31 -0
  58. package/src/webhook/route.ts +46 -0
  59. package/src/webhook/signature.ts +20 -0
package/README.md CHANGED
@@ -1,3 +1,116 @@
1
- # Temporary Holding Version
1
+ # GitHub producer
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Syncs repositories, issues, pull requests, comments, reviews, commits, checks,
4
+ Actions runs and jobs, and releases from one GitHub App installation. It
5
+ backfills each resource, takes webhooks at `POST /webhooks/github`, and polls
6
+ for changes every 15 minutes.
7
+
8
+ | Resource | What |
9
+ | ------------------------------ | ----------------------------------------------- |
10
+ | `repositories` | Repositories the installation can read |
11
+ | `issues` | Issues, without pull requests |
12
+ | `pull_requests` | Pull requests |
13
+ | `issue_comments` | Comments on issues and pull requests |
14
+ | `pull_request_reviews` | Pull request reviews |
15
+ | `pull_request_review_comments` | Comments on pull request diffs |
16
+ | `pull_request_commits` | Commits in each pull request |
17
+ | `commits` | Commits on the default branch |
18
+ | `check_runs` | Check runs, such as Actions jobs and other apps |
19
+ | `commit_statuses` | Commit statuses from CI services |
20
+ | `workflow_runs` | Actions workflow runs |
21
+ | `workflow_jobs` | Jobs of workflow runs, with their steps |
22
+ | `releases` | Releases, with their assets |
23
+
24
+ ## Config
25
+
26
+ | Variable | Required | Default |
27
+ | ------------------------ | -------- | ------- |
28
+ | `GITHUB_APP_CLIENT_ID` | yes | none |
29
+ | `GITHUB_APP_PRIVATE_KEY` | yes | none |
30
+ | `GITHUB_INSTALLATION_ID` | yes | none |
31
+ | `GITHUB_WEBHOOK_SECRET` | yes | none |
32
+
33
+ The private key can be on one line with `\n` for newlines.
34
+
35
+ ## Setup
36
+
37
+ Create a GitHub App under **Developer settings → GitHub Apps**:
38
+
39
+ - Webhook URL `<connector>/webhooks/github`, with a random secret.
40
+ - Repository permissions, read-only: Actions, Checks, Commit statuses,
41
+ Contents, Issues, and Pull requests.
42
+ - Events: Check run, Issue comment, Issues, Pull request, Pull request review,
43
+ Pull request review comment, Push, Release, Repository, Status, Workflow
44
+ job, and Workflow run.
45
+
46
+ Generate a private key, then install the app and pick the repositories to sync.
47
+ The installation ID is the number at the end of the installation page URL.
48
+
49
+ One app has one webhook URL, so use one app per connector.
50
+
51
+ ## API version
52
+
53
+ The connector pins REST API version `2026-03-10` with the
54
+ `X-GitHub-Api-Version` header.
55
+
56
+ ## Data
57
+
58
+ - `issues` has no pull requests. `issue_comments` has comments on both.
59
+ - Deleted repositories, issues, comments, and releases get `_deleted`. A
60
+ transferred issue is deleted under its old ID.
61
+ - `commits` and `pull_request_commits` keep author and committer names, not
62
+ emails.
63
+ - Reviews, check runs, and jobs have no update time in GitHub. Their version
64
+ is when the connector read them.
65
+ - A repository's issues, pull requests, and comments stay when it is deleted
66
+ or leaves the installation.
67
+ - Bodies are free text. Treat private repository data as confidential.
68
+
69
+ ## Limits
70
+
71
+ - Deletes only come from webhooks. A missed delete stays, even after a new
72
+ backfill. A restored repository comes back once GitHub reports it with a
73
+ newer update time.
74
+ - A row deleted during the backfill can make the next page skip one row.
75
+ - `commits` is the default branch only. Polling uses the commit time, so an
76
+ old commit pushed later only comes by webhook.
77
+ - Check runs and statuses are polled once, soon after a default-branch commit,
78
+ so a check that finishes later only updates by webhook. Webhooks bring them
79
+ for every branch.
80
+ - `pull_request_commits` has at most 250 commits per pull request. Commits
81
+ removed by a force push stay.
82
+ - A release asset's `download_count` is from the last time the release
83
+ changed.
84
+ - Workflow runs are polled for a day after they start. A later re-run comes by
85
+ webhook. A run row is its latest attempt; jobs keep every attempt.
86
+ - Reviews, pull request commits, check runs, statuses, and jobs cost one
87
+ request per pull request, commit, or run, in backfill and for each change.
88
+ A big repository with years of CI can take hours of rate limit to backfill.
89
+ - Polling costs about 12 requests per repository every 15 minutes, plus the
90
+ ones above. About 250 active repositories reach GitHub's limit.
91
+
92
+ ## Demo data
93
+
94
+ `pnpm demo --size 128MiB` writes made-up GitHub data without GitHub credentials.
95
+ See the Connector Kit README for the flags and the variables it needs.
96
+
97
+ Each change has an issue, the pull request that fixes it, comments, a review,
98
+ commits, CI runs with jobs and check runs, and, once merged, a commit on main
99
+ with a deploy status. Some merges ship a release. The 6 repositories don't grow
100
+ with the size.
101
+
102
+ ## Local development
103
+
104
+ ```bash
105
+ cd connectors/producer-github
106
+ pnpm sandbox
107
+ ```
108
+
109
+ Webhooks need a public URL that forwards to
110
+ `http://localhost:8080/webhooks/github`.
111
+
112
+ To record VCR, put the test app's values in `.env`, delete
113
+ `test/__cassettes__/api.vcr.test.cassette`, and run `pnpm test:ci`.
114
+
115
+ `pnpm start` runs the hosted connector. It needs the Wings and PostgreSQL
116
+ variables from the Connector Kit README.