@sentry/junior-github 0.94.0 → 0.95.0
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/SETUP.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# GitHub plugin setup
|
|
2
2
|
|
|
3
|
-
This plugin exposes two skills — `github-code` (clone, source-code investigation, pull requests) and `github-issues` (issue workflows). Junior uses GitHub App installation tokens for reads, allowlisted issue and pull request writes, and Git branch pushes. Human OAuth is reserved for explicitly personal operations such as pull request reviews.
|
|
3
|
+
This plugin exposes two skills — `github-code` (clone, source-code investigation, pull requests) and `github-issues` (issue workflows). Junior uses GitHub App installation tokens for reads, workflow dispatches, allowlisted issue and pull request writes, and Git branch pushes. Human OAuth is reserved for explicitly personal operations such as pull request reviews.
|
|
4
4
|
|
|
5
5
|
## 1) Create/install GitHub App
|
|
6
6
|
|
|
@@ -98,7 +98,7 @@ Use `additionalUserScopes` only when a human-identity integration flow requires
|
|
|
98
98
|
## 3) Runtime behavior
|
|
99
99
|
|
|
100
100
|
- When either GitHub skill is active, authenticated `gh` and `git` commands cause the runtime to inject GitHub credentials automatically for the current turn.
|
|
101
|
-
- The plugin classifies GitHub traffic from the forwarded HTTP request. Reads use `installation-read`, while `GET /user` uses `user-read`. Allowlisted issue and pull request mutations use repository-scoped installation grants. Git smart-HTTP pushes use `installation-pr-branch-write`. Unknown REST writes and GraphQL mutations are denied.
|
|
101
|
+
- The plugin classifies GitHub traffic from the forwarded HTTP request. Reads use `installation-read`, while `GET /user` uses `user-read`. Workflow dispatches use the repository-scoped `installation-actions-write` grant. Allowlisted issue and pull request mutations use their own repository-scoped installation grants. Git smart-HTTP pushes use `installation-pr-branch-write`. Unknown REST writes and GraphQL mutations are denied.
|
|
102
102
|
- `user-read` and the remaining explicitly human `user-write` operations require the actor, or an explicitly delegated user subject, to authorize the GitHub App through the private OAuth flow. Junior-owned issue, pull request, and branch operations do not fall back to user OAuth.
|
|
103
103
|
- Headless resource-event turns use the `resource-event` system actor and may receive the same repository-scoped installation grants. This lets Junior respond to subscribed pull request events by committing and pushing fixes without inheriting a subscriber's OAuth credential.
|
|
104
104
|
- Git commits use Junior as author and committer. Resolvable human run actors are credited once with `Co-Authored-By` trailers.
|
|
@@ -128,7 +128,7 @@ new resources through the typed tools, for example
|
|
|
128
128
|
Use `gh` for the allowlisted lifecycle operations described by the skill.
|
|
129
129
|
|
|
130
130
|
`gh` supports either direct `GITHUB_TOKEN` (for local debugging) or sandbox-level header injection.
|
|
131
|
-
The plugin uses installation credentials for read-only GitHub traffic, allowlisted issue and pull request mutations, and Git smart-HTTP pushes. GitHub App permissions still need to cover the operation: issues for issue edits/comments/labels, contents for pushes, pull requests for PR mutations, and workflows for workflow-file pushes.
|
|
131
|
+
The plugin uses installation credentials for read-only GitHub traffic, workflow dispatches, allowlisted issue and pull request mutations, and Git smart-HTTP pushes. GitHub App permissions still need to cover the operation: actions for workflow dispatches, issues for issue edits/comments/labels, contents for pushes, pull requests for PR mutations, and workflows for workflow-file pushes.
|
|
132
132
|
|
|
133
133
|
Committing and pushing code uses more than one GitHub surface:
|
|
134
134
|
|
package/dist/index.js
CHANGED
|
@@ -851,6 +851,9 @@ var USER_TOKEN_GRANTS = /* @__PURE__ */ new Set(["user-read", "user-write"]);
|
|
|
851
851
|
var CONTENTS_WRITE_REQUIREMENTS = [
|
|
852
852
|
"GitHub App Contents: write on the target repository"
|
|
853
853
|
];
|
|
854
|
+
var ACTIONS_WRITE_REQUIREMENTS = [
|
|
855
|
+
"GitHub App Actions: write on the target repository"
|
|
856
|
+
];
|
|
854
857
|
var ISSUES_WRITE_REQUIREMENTS = [
|
|
855
858
|
"GitHub App Issues: write on the target repository"
|
|
856
859
|
];
|
|
@@ -1787,6 +1790,11 @@ function githubApiWriteReason(method, upstreamUrl) {
|
|
|
1787
1790
|
if (!isGitHubApiUrl(upstreamUrl)) {
|
|
1788
1791
|
return void 0;
|
|
1789
1792
|
}
|
|
1793
|
+
if (method === "POST" && /^\/repos\/[^/]+\/[^/]+\/actions\/workflows\/[^/]+\/dispatches$/.test(
|
|
1794
|
+
pathname
|
|
1795
|
+
)) {
|
|
1796
|
+
return "github.actions-workflow-dispatch";
|
|
1797
|
+
}
|
|
1790
1798
|
if (method === "POST" && /^\/repos\/[^/]+\/[^/]+\/issues$/.test(pathname)) {
|
|
1791
1799
|
return "github.issue-create";
|
|
1792
1800
|
}
|
|
@@ -1907,6 +1915,9 @@ function assertGitHubWriteAllowed(input) {
|
|
|
1907
1915
|
}
|
|
1908
1916
|
}
|
|
1909
1917
|
function grantRequirements(reason) {
|
|
1918
|
+
if (reason === "github.actions-workflow-dispatch") {
|
|
1919
|
+
return ACTIONS_WRITE_REQUIREMENTS;
|
|
1920
|
+
}
|
|
1910
1921
|
if (reason === "github.git-write" || reason === "github.contents-write") {
|
|
1911
1922
|
return CONTENTS_WRITE_REQUIREMENTS;
|
|
1912
1923
|
}
|
|
@@ -1942,6 +1953,14 @@ function repositoryLeaseScope(upstreamUrl) {
|
|
|
1942
1953
|
}
|
|
1943
1954
|
function installationGrantForWrite(reason, upstreamUrl) {
|
|
1944
1955
|
const leaseScope = repositoryLeaseScope(upstreamUrl);
|
|
1956
|
+
if (reason === "github.actions-workflow-dispatch") {
|
|
1957
|
+
return grantForAccess(
|
|
1958
|
+
"write",
|
|
1959
|
+
reason,
|
|
1960
|
+
"installation-actions-write",
|
|
1961
|
+
leaseScope
|
|
1962
|
+
);
|
|
1963
|
+
}
|
|
1945
1964
|
if (reason === "github.issue-create" || reason === "github.issues-write") {
|
|
1946
1965
|
return grantForAccess(
|
|
1947
1966
|
"write",
|
|
@@ -2188,11 +2207,11 @@ function githubPlugin(options = {}) {
|
|
|
2188
2207
|
...appReadPermissions ? { permissions: appReadPermissions } : { loadPermissions: loadReadPermissions }
|
|
2189
2208
|
});
|
|
2190
2209
|
}
|
|
2191
|
-
if (ctx.grant.name === "installation-issues-write" || ctx.grant.name === "installation-pull-requests-write") {
|
|
2210
|
+
if (ctx.grant.name === "installation-actions-write" || ctx.grant.name === "installation-issues-write" || ctx.grant.name === "installation-pull-requests-write") {
|
|
2192
2211
|
const repository = githubRepositoryFromLeaseScope(
|
|
2193
2212
|
ctx.grant.leaseScope
|
|
2194
2213
|
);
|
|
2195
|
-
const permission = ctx.grant.name === "installation-issues-write" ? "issues" : "pull_requests";
|
|
2214
|
+
const permission = ctx.grant.name === "installation-actions-write" ? "actions" : ctx.grant.name === "installation-issues-write" ? "issues" : "pull_requests";
|
|
2196
2215
|
return await issueInstallationCredential({
|
|
2197
2216
|
appIdEnv,
|
|
2198
2217
|
privateKeyEnv,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/junior-github",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.95.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@sinclair/typebox": "^0.34.49",
|
|
27
27
|
"zod": "^4.4.3",
|
|
28
|
-
"@sentry/junior-plugin-api": "0.
|
|
28
|
+
"@sentry/junior-plugin-api": "0.95.0"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@types/node": "^25.9.1",
|
|
@@ -161,7 +161,9 @@ Before finishing, reconcile any plan or checklist stated earlier — mark items
|
|
|
161
161
|
|
|
162
162
|
**PR inspection** — read-only `gh pr` and `gh api` commands. Query both conversation comments (`--json comments`) and review comments (`gh api .../pulls/{n}/comments` and `.../reviews`).
|
|
163
163
|
|
|
164
|
-
**PR mutation** — push before create. Use only the allowlisted REST endpoints in the API reference. Merge, close-with-delete,
|
|
164
|
+
**PR mutation** — push before create. Use only the allowlisted REST endpoints in the API reference. Merge, close-with-delete, REST ref mutation, and admin operations are unsupported. Git smart HTTP does not independently prevent force updates or ref deletion; rely on GitHub rulesets and do not request destructive pushes.
|
|
165
|
+
|
|
166
|
+
**Workflow dispatch** — `gh workflow run` is supported for workflows that declare `workflow_dispatch`. Workflow reruns, cancellations, and other Actions mutations remain unsupported.
|
|
165
167
|
|
|
166
168
|
## Guardrails
|
|
167
169
|
|
|
@@ -13,6 +13,7 @@ Treat explicit repo flags as command-targeting safety rails, not as a credential
|
|
|
13
13
|
| Permission capability | Commands |
|
|
14
14
|
| ---------------------------- | ------------------------------------------------------------------------------------ |
|
|
15
15
|
| `github.actions.read` | `gh run list`, `gh run view`, `gh run watch`, `gh workflow list`, `gh workflow view` |
|
|
16
|
+
| `github.actions.write` | `gh workflow run` only |
|
|
16
17
|
| `github.contents.read` | `gh repo clone`, `git fetch` |
|
|
17
18
|
| `github.contents.write` | Git smart-HTTP `git push` only |
|
|
18
19
|
| `github.workflows.write` | Workflow-file changes carried by Git smart-HTTP push |
|
|
@@ -34,6 +35,7 @@ Treat explicit repo flags as command-targeting safety rails, not as a credential
|
|
|
34
35
|
| Create branch | `git -C DIRECTORY checkout -b BRANCH` |
|
|
35
36
|
| Stage and commit | `git -C DIRECTORY add -A && git -C DIRECTORY commit -m "message"` |
|
|
36
37
|
| Push branch before PR creation | `git -C DIRECTORY push -u origin BRANCH` |
|
|
38
|
+
| Dispatch workflow | `gh workflow run WORKFLOW --repo owner/repo --ref REF [-f key=value]` |
|
|
37
39
|
| Create pull request (draft) | `github_createPullRequest({ repo: "owner/repo", head: "BRANCH", base: "BASE", title: "...", body: "...", draft: true })` |
|
|
38
40
|
| Update pull request | `gh api repos/owner/repo/pulls/NUMBER --method PATCH --input payload.json` |
|
|
39
41
|
| Mark ready for review | `gh api repos/owner/repo/pulls/NUMBER/ready_for_review --method POST` |
|
|
@@ -65,7 +67,7 @@ jr-rpc config set github.repo owner/repo
|
|
|
65
67
|
- A local `git commit` does not call GitHub. Pushing that commit uses Junior's repository-scoped installation credential and requires `github.contents.write` on the target repo.
|
|
66
68
|
- If the commit changes workflow files under `.github/workflows`, expect `github.workflows.write` in addition to contents write.
|
|
67
69
|
- Before `github_createPullRequest`, push the head branch explicitly and resolve the target repo's default branch for `base`. That push requires GitHub write access to the remote.
|
|
68
|
-
- Merge, fork creation, workflow
|
|
70
|
+
- Merge, fork creation, workflow reruns or cancellations, REST contents/Git database writes, and repository administration are outside the current write allowlist.
|
|
69
71
|
- If the explicit `git push` fails with 401/403 or another access/permission error, verify the repo context and retry once. If it still fails, load troubleshooting guidance and report the exact command failure.
|
|
70
72
|
- PR comments, labels, and assignees use GitHub's issue endpoints and therefore the issue grant; use the `github-issues` REST guidance for those operations.
|
|
71
73
|
- Return actionable errors for access, permission, not-found, and validation failures.
|