@emulators/github 0.3.0 → 0.4.1
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.
- package/README.md +178 -0
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/README.md
ADDED
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
# @emulators/github
|
|
2
|
+
|
|
3
|
+
Fully stateful GitHub API emulation. Creates, updates, and deletes persist in memory and affect related entities.
|
|
4
|
+
|
|
5
|
+
Part of [emulate](https://github.com/vercel-labs/emulate) — local drop-in replacement services for CI and no-network sandboxes.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @emulators/github
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Endpoints
|
|
14
|
+
|
|
15
|
+
### Users
|
|
16
|
+
- `GET /user` — authenticated user
|
|
17
|
+
- `PATCH /user` — update profile
|
|
18
|
+
- `GET /users/:username` — get user
|
|
19
|
+
- `GET /users` — list users
|
|
20
|
+
- `GET /users/:username/repos` — list user repos
|
|
21
|
+
- `GET /users/:username/orgs` — list user orgs
|
|
22
|
+
- `GET /users/:username/followers` — list followers
|
|
23
|
+
- `GET /users/:username/following` — list following
|
|
24
|
+
|
|
25
|
+
### Repositories
|
|
26
|
+
- `GET /repos/:owner/:repo` — get repo
|
|
27
|
+
- `POST /user/repos` — create user repo
|
|
28
|
+
- `POST /orgs/:org/repos` — create org repo
|
|
29
|
+
- `PATCH /repos/:owner/:repo` — update repo
|
|
30
|
+
- `DELETE /repos/:owner/:repo` — delete repo (cascades)
|
|
31
|
+
- `GET/PUT /repos/:owner/:repo/topics` — get/replace topics
|
|
32
|
+
- `GET /repos/:owner/:repo/languages` — languages
|
|
33
|
+
- `GET /repos/:owner/:repo/contributors` — contributors
|
|
34
|
+
- `GET /repos/:owner/:repo/forks` — list forks
|
|
35
|
+
- `POST /repos/:owner/:repo/forks` — create fork
|
|
36
|
+
- `GET/PUT/DELETE /repos/:owner/:repo/collaborators/:username` — collaborators
|
|
37
|
+
- `GET /repos/:owner/:repo/collaborators/:username/permission`
|
|
38
|
+
- `POST /repos/:owner/:repo/transfer` — transfer repo
|
|
39
|
+
- `GET /repos/:owner/:repo/tags` — list tags
|
|
40
|
+
|
|
41
|
+
### Issues
|
|
42
|
+
- `GET /repos/:owner/:repo/issues` — list (filter by state, labels, assignee, milestone, creator, since)
|
|
43
|
+
- `POST /repos/:owner/:repo/issues` — create
|
|
44
|
+
- `GET /repos/:owner/:repo/issues/:number` — get
|
|
45
|
+
- `PATCH /repos/:owner/:repo/issues/:number` — update (state transitions, events)
|
|
46
|
+
- `PUT/DELETE /repos/:owner/:repo/issues/:number/lock` — lock/unlock
|
|
47
|
+
- `GET /repos/:owner/:repo/issues/:number/timeline` — timeline events
|
|
48
|
+
- `GET /repos/:owner/:repo/issues/:number/events` — events
|
|
49
|
+
- `POST/DELETE /repos/:owner/:repo/issues/:number/assignees` — manage assignees
|
|
50
|
+
|
|
51
|
+
### Pull Requests
|
|
52
|
+
- `GET /repos/:owner/:repo/pulls` — list (filter by state, head, base)
|
|
53
|
+
- `POST /repos/:owner/:repo/pulls` — create
|
|
54
|
+
- `GET /repos/:owner/:repo/pulls/:number` — get
|
|
55
|
+
- `PATCH /repos/:owner/:repo/pulls/:number` — update
|
|
56
|
+
- `PUT /repos/:owner/:repo/pulls/:number/merge` — merge (with branch protection enforcement)
|
|
57
|
+
- `GET /repos/:owner/:repo/pulls/:number/commits` — list commits
|
|
58
|
+
- `GET /repos/:owner/:repo/pulls/:number/files` — list files
|
|
59
|
+
- `POST/DELETE /repos/:owner/:repo/pulls/:number/requested_reviewers` — manage reviewers
|
|
60
|
+
- `PUT /repos/:owner/:repo/pulls/:number/update-branch` — update branch
|
|
61
|
+
|
|
62
|
+
### Comments
|
|
63
|
+
- Issue comments: full CRUD on `/repos/:owner/:repo/issues/:number/comments`
|
|
64
|
+
- Review comments: full CRUD on `/repos/:owner/:repo/pulls/:number/comments`
|
|
65
|
+
- Commit comments: full CRUD on `/repos/:owner/:repo/commits/:sha/comments`
|
|
66
|
+
- Repo-wide listings for each type
|
|
67
|
+
|
|
68
|
+
### Reviews
|
|
69
|
+
- `GET /repos/:owner/:repo/pulls/:number/reviews` — list
|
|
70
|
+
- `POST /repos/:owner/:repo/pulls/:number/reviews` — create (with inline comments)
|
|
71
|
+
- `GET/PUT /repos/:owner/:repo/pulls/:number/reviews/:id` — get/update
|
|
72
|
+
- `POST /repos/:owner/:repo/pulls/:number/reviews/:id/events` — submit
|
|
73
|
+
- `PUT /repos/:owner/:repo/pulls/:number/reviews/:id/dismissals` — dismiss
|
|
74
|
+
|
|
75
|
+
### Labels & Milestones
|
|
76
|
+
- Labels: full CRUD, add/remove from issues, replace all
|
|
77
|
+
- Milestones: full CRUD, state transitions, issue counts
|
|
78
|
+
|
|
79
|
+
### Branches & Git Data
|
|
80
|
+
- Branches: list, get, protection CRUD (status checks, PR reviews, enforce admins)
|
|
81
|
+
- Refs: get, match, create, update, delete
|
|
82
|
+
- Commits: get, create
|
|
83
|
+
- Trees: get (with recursive), create (with inline content)
|
|
84
|
+
- Blobs: get, create
|
|
85
|
+
- Tags: get, create
|
|
86
|
+
|
|
87
|
+
### Organizations & Teams
|
|
88
|
+
- Orgs: get, update, list
|
|
89
|
+
- Org members: list, check, remove, get/set membership
|
|
90
|
+
- Teams: full CRUD, members, repos
|
|
91
|
+
|
|
92
|
+
### Releases
|
|
93
|
+
- Releases: full CRUD, latest, by tag
|
|
94
|
+
- Release assets: full CRUD, upload
|
|
95
|
+
- Generate release notes
|
|
96
|
+
|
|
97
|
+
### Webhooks
|
|
98
|
+
- Repo webhooks: full CRUD, ping, test, deliveries
|
|
99
|
+
- Org webhooks: full CRUD, ping
|
|
100
|
+
- Real HTTP delivery to registered URLs on all state changes
|
|
101
|
+
|
|
102
|
+
### Search
|
|
103
|
+
- `GET /search/repositories` — full query syntax (user, org, language, topic, stars, forks, etc.)
|
|
104
|
+
- `GET /search/issues` — issues + PRs (repo, is, author, label, milestone, state, etc.)
|
|
105
|
+
- `GET /search/users` — users + orgs
|
|
106
|
+
- `GET /search/code` — blob content search
|
|
107
|
+
- `GET /search/commits` — commit message search
|
|
108
|
+
- `GET /search/topics` — topic search
|
|
109
|
+
- `GET /search/labels` — label search
|
|
110
|
+
|
|
111
|
+
### Actions
|
|
112
|
+
- Workflows: list, get, enable/disable, dispatch
|
|
113
|
+
- Workflow runs: list, get, cancel, rerun, delete, logs
|
|
114
|
+
- Jobs: list, get, logs
|
|
115
|
+
- Artifacts: list, get, delete
|
|
116
|
+
- Secrets: repo + org CRUD
|
|
117
|
+
|
|
118
|
+
### Checks
|
|
119
|
+
- Check runs: create, update, get, annotations, rerequest, list by ref/suite
|
|
120
|
+
- Check suites: create, get, preferences, rerequest, list by ref
|
|
121
|
+
- Automatic suite status rollup from check run results
|
|
122
|
+
|
|
123
|
+
### Misc
|
|
124
|
+
- `GET /rate_limit` — rate limit status
|
|
125
|
+
- `GET /meta` — server metadata
|
|
126
|
+
- `GET /octocat` — ASCII art
|
|
127
|
+
- `GET /emojis` — emoji URLs
|
|
128
|
+
- `GET /zen` — random zen phrase
|
|
129
|
+
- `GET /versions` — API versions
|
|
130
|
+
|
|
131
|
+
## Auth
|
|
132
|
+
|
|
133
|
+
Public repo endpoints work without auth. Private repos and write operations require a valid token. Pagination uses `page`/`per_page` with `Link` headers.
|
|
134
|
+
|
|
135
|
+
## Seed Configuration
|
|
136
|
+
|
|
137
|
+
```yaml
|
|
138
|
+
github:
|
|
139
|
+
users:
|
|
140
|
+
- login: octocat
|
|
141
|
+
name: The Octocat
|
|
142
|
+
email: octocat@github.com
|
|
143
|
+
orgs:
|
|
144
|
+
- login: my-org
|
|
145
|
+
name: My Organization
|
|
146
|
+
repos:
|
|
147
|
+
- owner: octocat
|
|
148
|
+
name: hello-world
|
|
149
|
+
language: JavaScript
|
|
150
|
+
auto_init: true
|
|
151
|
+
oauth_apps:
|
|
152
|
+
- client_id: "Iv1.abc123"
|
|
153
|
+
client_secret: "secret_abc123"
|
|
154
|
+
name: "My Web App"
|
|
155
|
+
redirect_uris:
|
|
156
|
+
- "http://localhost:3000/api/auth/callback/github"
|
|
157
|
+
apps:
|
|
158
|
+
- app_id: 12345
|
|
159
|
+
slug: "my-github-app"
|
|
160
|
+
name: "My GitHub App"
|
|
161
|
+
private_key: |
|
|
162
|
+
-----BEGIN RSA PRIVATE KEY-----
|
|
163
|
+
...your PEM key...
|
|
164
|
+
-----END RSA PRIVATE KEY-----
|
|
165
|
+
permissions:
|
|
166
|
+
contents: read
|
|
167
|
+
issues: write
|
|
168
|
+
events: [push, pull_request]
|
|
169
|
+
installations:
|
|
170
|
+
- installation_id: 100
|
|
171
|
+
account: my-org
|
|
172
|
+
repository_selection: all
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
## Links
|
|
176
|
+
|
|
177
|
+
- [Full documentation](https://emulate.dev/github)
|
|
178
|
+
- [GitHub](https://github.com/vercel-labs/emulate)
|