@lonca/baron-adapter-github 0.1.0 → 0.2.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.
Files changed (2) hide show
  1. package/dist/index.js +32 -1
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -29,6 +29,7 @@ function createGithubTransport(options) {
29
29
  discriminator: discriminator ?? data.state ?? GH_STATE.OPEN,
30
30
  parentId: void 0,
31
31
  labels: labelNames(data.labels),
32
+ assignee: data.assignee?.login ?? void 0,
32
33
  url: data.html_url
33
34
  });
34
35
  return {
@@ -96,6 +97,15 @@ function createGithubTransport(options) {
96
97
  url: data.html_url
97
98
  };
98
99
  },
100
+ async assignIssue(id, assignee) {
101
+ const { data } = await octokit.rest.issues.update({
102
+ owner,
103
+ repo,
104
+ issue_number: Number(id),
105
+ assignees: [assignee]
106
+ });
107
+ return toNative(data);
108
+ },
99
109
  async linkIssues() {
100
110
  throw new BaronError(
101
111
  "GitHub has no native typed issue links; links are handled by the gap policy, not the transport.",
@@ -209,6 +219,26 @@ function createGithubScmTransport(options) {
209
219
  });
210
220
  return { id: String(data.id), url: data.html_url };
211
221
  },
222
+ async findPullRequestByBranch(sourceBranch) {
223
+ const { data } = await octokit.rest.pulls.list({
224
+ owner,
225
+ repo,
226
+ state: "open",
227
+ head: `${owner}:${sourceBranch}`,
228
+ per_page: 1
229
+ });
230
+ const pr = data[0];
231
+ if (pr === void 0) return void 0;
232
+ return {
233
+ id: String(pr.number),
234
+ number: String(pr.number),
235
+ title: pr.title,
236
+ url: pr.html_url,
237
+ sourceBranch,
238
+ targetBranch: pr.base.ref,
239
+ draft: pr.draft ?? false
240
+ };
241
+ },
212
242
  async defaultBranch() {
213
243
  const { data } = await octokit.rest.repos.get({ owner, repo });
214
244
  return data.default_branch;
@@ -499,7 +529,8 @@ var githubManifest = {
499
529
  arbitraryStates: false,
500
530
  nativeLabels: true,
501
531
  comments: true,
502
- issueLinks: false
532
+ issueLinks: false,
533
+ assignment: true
503
534
  }
504
535
  };
505
536
  var exampleGithubRoleMap = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lonca/baron-adapter-github",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "main": "./dist/index.js",
@@ -16,11 +16,11 @@
16
16
  ],
17
17
  "dependencies": {
18
18
  "octokit": "^5.0.5",
19
- "@lonca/baron-core": "0.1.0"
19
+ "@lonca/baron-core": "0.2.0"
20
20
  },
21
21
  "devDependencies": {
22
22
  "@types/node": "^22.0.0",
23
- "@lonca/baron-conformance": "0.1.0"
23
+ "@lonca/baron-conformance": "0.2.0"
24
24
  },
25
25
  "description": "Baron adapter for GitHub: issues, scm, ci, deploy.",
26
26
  "keywords": [