@lonca/baron-adapter-github 0.2.0 → 0.4.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/dist/index.js +9 -0
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -8,6 +8,7 @@ var GITHUB_PROVIDER = "github";
|
|
|
8
8
|
|
|
9
9
|
// src/transport.ts
|
|
10
10
|
import {
|
|
11
|
+
ASSIGNEE_ME,
|
|
11
12
|
BaronError
|
|
12
13
|
} from "@lonca/baron-core";
|
|
13
14
|
import { Octokit } from "octokit";
|
|
@@ -20,6 +21,12 @@ function labelNames(labels) {
|
|
|
20
21
|
function createGithubTransport(options) {
|
|
21
22
|
const { owner, repo, token } = options;
|
|
22
23
|
const octokit = new Octokit({ auth: token });
|
|
24
|
+
let myLogin;
|
|
25
|
+
const resolveAssignee = (assignee) => {
|
|
26
|
+
if (assignee !== ASSIGNEE_ME) return Promise.resolve(assignee);
|
|
27
|
+
myLogin ??= octokit.rest.users.getAuthenticated().then(({ data }) => data.login);
|
|
28
|
+
return myLogin;
|
|
29
|
+
};
|
|
23
30
|
const toNative = (data, discriminator) => ({
|
|
24
31
|
id: String(data.number),
|
|
25
32
|
key: `#${data.number}`,
|
|
@@ -117,12 +124,14 @@ function createGithubTransport(options) {
|
|
|
117
124
|
const label = query.target?.[TARGET.LABEL];
|
|
118
125
|
const state = stateValue === GH_STATE.CLOSED ? GH_STATE.CLOSED : stateValue === GH_STATE.OPEN ? GH_STATE.OPEN : "all";
|
|
119
126
|
const { limit } = query;
|
|
127
|
+
const assignee = query.assignee === void 0 ? void 0 : await resolveAssignee(query.assignee);
|
|
120
128
|
const results = [];
|
|
121
129
|
for await (const { data } of octokit.paginate.iterator(octokit.rest.issues.listForRepo, {
|
|
122
130
|
owner,
|
|
123
131
|
repo,
|
|
124
132
|
state,
|
|
125
133
|
...label !== void 0 ? { labels: label } : {},
|
|
134
|
+
...assignee !== void 0 ? { assignee } : {},
|
|
126
135
|
per_page: 100
|
|
127
136
|
})) {
|
|
128
137
|
for (const item of data) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lonca/baron-adapter-github",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.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.
|
|
19
|
+
"@lonca/baron-core": "0.4.0"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@types/node": "^22.0.0",
|
|
23
|
-
"@lonca/baron-conformance": "0.
|
|
23
|
+
"@lonca/baron-conformance": "0.4.0"
|
|
24
24
|
},
|
|
25
25
|
"description": "Baron adapter for GitHub: issues, scm, ci, deploy.",
|
|
26
26
|
"keywords": [
|