tigger 0.0.0 → 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.
- package/README.md +21 -0
- package/bin/constants.js +19 -0
- package/bin/example/handler/alterIssue.js +30 -0
- package/bin/example/handler/commit.js +44 -0
- package/bin/example/handler/createComment.js +30 -0
- package/bin/example/handler/createIssue.js +28 -0
- package/bin/example/handler/editComment.js +32 -0
- package/bin/example/handler/editIssue.js +32 -0
- package/bin/example/handler/issue.js +26 -0
- package/bin/example/handler/issues.js +24 -0
- package/bin/example/handler/removeComment.js +30 -0
- package/bin/example/operation/alterIssue.js +29 -0
- package/bin/example/operation/createComment.js +29 -0
- package/bin/example/operation/createIssue.js +36 -0
- package/bin/example/operation/editComment.js +29 -0
- package/bin/example/operation/editIssue.js +29 -0
- package/bin/example/operation/getBaseTreeSHA.js +36 -0
- package/bin/example/operation/getComments.js +36 -0
- package/bin/example/operation/getIssue.js +35 -0
- package/bin/example/operation/getIssues.js +35 -0
- package/bin/example/operation/getLatestCommitSHA.js +36 -0
- package/bin/example/operation/postCommitSHA.js +35 -0
- package/bin/example/operation/postCommitTreeSHA.js +43 -0
- package/bin/example/operation/postMetaJSONFileContent.js +36 -0
- package/bin/example/operation/postReadmeFileContent.js +36 -0
- package/bin/example/operation/postUpdatedHead.js +29 -0
- package/bin/example/operation/removeComment.js +27 -0
- package/bin/example.js +24 -0
- package/bin/uris.js +31 -0
- package/bin/utilities/comment.js +68 -0
- package/bin/utilities/commit.js +115 -0
- package/bin/utilities/headers.js +43 -0
- package/bin/utilities/issue.js +87 -0
- package/bin/utilities/repository.js +39 -0
- package/bin/utilities/request.js +94 -0
- package/index.js +11 -0
- package/license.txt +48 -0
- package/package.json +9 -12
package/README.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Tigger
|
|
2
|
+
|
|
3
|
+
Tales the fun out of using the GitHub API.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
With [npm](https://www.npmjs.com/):
|
|
8
|
+
|
|
9
|
+
npm install tigger
|
|
10
|
+
|
|
11
|
+
You can also clone the repository with [Git](https://git-scm.com/)...
|
|
12
|
+
|
|
13
|
+
git clone https://github.com/djalbat/tigger.git
|
|
14
|
+
|
|
15
|
+
...then install the dependencies with npm from within the project's root directory:
|
|
16
|
+
|
|
17
|
+
npm install
|
|
18
|
+
|
|
19
|
+
## Contact
|
|
20
|
+
|
|
21
|
+
- james.smith@djalbat.com
|
package/bin/constants.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const END = "end",
|
|
4
|
+
DATA = "data",
|
|
5
|
+
BLOB_TYPE = "blob",
|
|
6
|
+
BLOB_MODE = "100644",
|
|
7
|
+
EMPTY_STRING = "",
|
|
8
|
+
GITHUB_API_HOST = "https://api.github.com",
|
|
9
|
+
APPLICATION_VND_GITHUB_VS_JSON = "application/vnd.github.v3+json";
|
|
10
|
+
|
|
11
|
+
module.exports = {
|
|
12
|
+
END,
|
|
13
|
+
DATA,
|
|
14
|
+
BLOB_TYPE,
|
|
15
|
+
BLOB_MODE,
|
|
16
|
+
EMPTY_STRING,
|
|
17
|
+
GITHUB_API_HOST,
|
|
18
|
+
APPLICATION_VND_GITHUB_VS_JSON
|
|
19
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const { asynchronousUtilities } = require("necessary");
|
|
4
|
+
|
|
5
|
+
const getIssueOperation = require("../operation/getIssue"),
|
|
6
|
+
alterIssueOperation = require("../operation/alterIssue"),
|
|
7
|
+
getCommentsOperation = require("../operation/getComments");
|
|
8
|
+
|
|
9
|
+
const { sequence } = asynchronousUtilities;
|
|
10
|
+
|
|
11
|
+
function alterIssueHandler(context) {
|
|
12
|
+
const operations = [
|
|
13
|
+
alterIssueOperation,
|
|
14
|
+
getIssueOperation,
|
|
15
|
+
getCommentsOperation
|
|
16
|
+
],
|
|
17
|
+
state = "closed",
|
|
18
|
+
issueNumber = 1;
|
|
19
|
+
|
|
20
|
+
Object.assign(context, {
|
|
21
|
+
state,
|
|
22
|
+
issueNumber
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
sequence(operations, () => {
|
|
26
|
+
///
|
|
27
|
+
}, context);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
module.exports = alterIssueHandler;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const { asynchronousUtilities } = require("necessary");
|
|
4
|
+
|
|
5
|
+
const postCommitSHAOperation = require("../operation/postCommitSHA"),
|
|
6
|
+
getBaseTreeSHAOperation = require("../operation/getBaseTreeSHA"),
|
|
7
|
+
postUpdatedHeadOperation = require("../operation/postUpdatedHead"),
|
|
8
|
+
postCommitTreeSHAOperation = require("../operation/postCommitTreeSHA"),
|
|
9
|
+
getLatestCommitSHAOperation = require("../operation/getLatestCommitSHA"),
|
|
10
|
+
postReadmeFileContentOperation = require("../operation/postReadmeFileContent"),
|
|
11
|
+
postMetaJSONFileContentOperation = require("../operation/postMetaJSONFileContent");
|
|
12
|
+
|
|
13
|
+
const { sequence } = asynchronousUtilities;
|
|
14
|
+
|
|
15
|
+
function commitHandler(context) {
|
|
16
|
+
const commitMessage = "...",
|
|
17
|
+
readmeFilePath = "...",
|
|
18
|
+
metaJSONFilePath = "...",
|
|
19
|
+
readmeFileContent = "...",
|
|
20
|
+
metaJSONFileContent = "...",
|
|
21
|
+
operations = [
|
|
22
|
+
getLatestCommitSHAOperation,
|
|
23
|
+
getBaseTreeSHAOperation,
|
|
24
|
+
postReadmeFileContentOperation,
|
|
25
|
+
postMetaJSONFileContentOperation,
|
|
26
|
+
postCommitTreeSHAOperation,
|
|
27
|
+
postCommitSHAOperation,
|
|
28
|
+
postUpdatedHeadOperation
|
|
29
|
+
];
|
|
30
|
+
|
|
31
|
+
Object.assign(context, {
|
|
32
|
+
commitMessage,
|
|
33
|
+
readmeFilePath,
|
|
34
|
+
metaJSONFilePath,
|
|
35
|
+
readmeFileContent,
|
|
36
|
+
metaJSONFileContent
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
sequence(operations, () => {
|
|
40
|
+
///
|
|
41
|
+
}, context);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
module.exports = commitHandler;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const { asynchronousUtilities } = require("necessary");
|
|
4
|
+
|
|
5
|
+
const getIssueOperation = require("../operation/getIssue"),
|
|
6
|
+
getCommentsOperation = require("../operation/getComments"),
|
|
7
|
+
createCommentOperation = require("../operation/createComment");
|
|
8
|
+
|
|
9
|
+
const { sequence } = asynchronousUtilities;
|
|
10
|
+
|
|
11
|
+
function createCommentHandler(context) {
|
|
12
|
+
const operations = [
|
|
13
|
+
createCommentOperation,
|
|
14
|
+
getIssueOperation,
|
|
15
|
+
getCommentsOperation
|
|
16
|
+
],
|
|
17
|
+
issueNumber = 1,
|
|
18
|
+
description = "...";
|
|
19
|
+
|
|
20
|
+
Object.assign(context, {
|
|
21
|
+
description,
|
|
22
|
+
issueNumber
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
sequence(operations, () => {
|
|
26
|
+
///
|
|
27
|
+
}, context);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
module.exports = createCommentHandler;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const { asynchronousUtilities } = require("necessary");
|
|
4
|
+
|
|
5
|
+
const getIssueOperation = require("../operation/getIssue"),
|
|
6
|
+
createIssueOperation = require("../operation/createIssue");
|
|
7
|
+
|
|
8
|
+
const { sequence } = asynchronousUtilities;
|
|
9
|
+
|
|
10
|
+
function createIssueHandler(context) {
|
|
11
|
+
const operations = [
|
|
12
|
+
createIssueOperation,
|
|
13
|
+
getIssueOperation
|
|
14
|
+
],
|
|
15
|
+
title = "...",
|
|
16
|
+
description = "...";
|
|
17
|
+
|
|
18
|
+
Object.assign(context, {
|
|
19
|
+
title,
|
|
20
|
+
description
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
sequence(operations, () => {
|
|
24
|
+
///
|
|
25
|
+
}, context);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
module.exports = createIssueHandler;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const { asynchronousUtilities } = require("necessary");
|
|
4
|
+
|
|
5
|
+
const getIssueOperation = require("../operation/getIssue"),
|
|
6
|
+
getCommentsOperation = require("../operation/getComments"),
|
|
7
|
+
editCommentOperation = require("../operation/editComment");
|
|
8
|
+
|
|
9
|
+
const { sequence } = asynchronousUtilities;
|
|
10
|
+
|
|
11
|
+
function editCommentHandler(context) {
|
|
12
|
+
const operations = [
|
|
13
|
+
editCommentOperation,
|
|
14
|
+
getIssueOperation,
|
|
15
|
+
getCommentsOperation
|
|
16
|
+
],
|
|
17
|
+
issueNumber = 1,
|
|
18
|
+
description = "...",
|
|
19
|
+
commentIdentifier = 123;
|
|
20
|
+
|
|
21
|
+
Object.assign(context, {
|
|
22
|
+
description,
|
|
23
|
+
issueNumber,
|
|
24
|
+
commentIdentifier
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
sequence(operations, () => {
|
|
28
|
+
debugger
|
|
29
|
+
}, context);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
module.exports = editCommentHandler;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const { asynchronousUtilities } = require("necessary");
|
|
4
|
+
|
|
5
|
+
const getIssueOperation = require("../operation/getIssue"),
|
|
6
|
+
editIssueOperation = require("../operation/editIssue"),
|
|
7
|
+
getCommentsOperation = require("../operation/getComments");
|
|
8
|
+
|
|
9
|
+
const { sequence } = asynchronousUtilities;
|
|
10
|
+
|
|
11
|
+
function editIssueHandler(context) {
|
|
12
|
+
const operations = [
|
|
13
|
+
editIssueOperation,
|
|
14
|
+
getIssueOperation,
|
|
15
|
+
getCommentsOperation
|
|
16
|
+
],
|
|
17
|
+
title = "...",
|
|
18
|
+
issueNumber = 1,
|
|
19
|
+
description = "...";
|
|
20
|
+
|
|
21
|
+
Object.assign(context, {
|
|
22
|
+
title,
|
|
23
|
+
description,
|
|
24
|
+
issueNumber
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
sequence(operations, () => {
|
|
28
|
+
///
|
|
29
|
+
}, context);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
module.exports = editIssueHandler;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const { asynchronousUtilities } = require("necessary");
|
|
4
|
+
|
|
5
|
+
const getIssueOperation = require("../operation/getIssue"),
|
|
6
|
+
getCommentsOperation = require("../operation/getComments");
|
|
7
|
+
|
|
8
|
+
const { sequence } = asynchronousUtilities;
|
|
9
|
+
|
|
10
|
+
function issueHandler(context) {
|
|
11
|
+
const operations = [
|
|
12
|
+
getIssueOperation,
|
|
13
|
+
getCommentsOperation
|
|
14
|
+
],
|
|
15
|
+
issueNumber = 1;
|
|
16
|
+
|
|
17
|
+
Object.assign(context, {
|
|
18
|
+
issueNumber
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
sequence(operations, () => {
|
|
22
|
+
///
|
|
23
|
+
}, context);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
module.exports = issueHandler;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const { asynchronousUtilities } = require("necessary");
|
|
4
|
+
|
|
5
|
+
const getIssuesOperation = require("../operation/getIssues");
|
|
6
|
+
|
|
7
|
+
const { sequence } = asynchronousUtilities;
|
|
8
|
+
|
|
9
|
+
function issuesHandler(context) {
|
|
10
|
+
const operations = [
|
|
11
|
+
getIssuesOperation
|
|
12
|
+
],
|
|
13
|
+
state = "open";
|
|
14
|
+
|
|
15
|
+
Object.assign(context, {
|
|
16
|
+
state
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
sequence(operations, () => {
|
|
20
|
+
///
|
|
21
|
+
}, context);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
module.exports = issuesHandler;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const { asynchronousUtilities } = require("necessary");
|
|
4
|
+
|
|
5
|
+
const getIssueOperation = require("../operation/getIssue"),
|
|
6
|
+
getCommentsOperation = require("../operation/getComments"),
|
|
7
|
+
removeCommentOperation = require("../operation/removeComment");
|
|
8
|
+
|
|
9
|
+
const { sequence } = asynchronousUtilities;
|
|
10
|
+
|
|
11
|
+
function removeCommentHandler(context) {
|
|
12
|
+
const operations = [
|
|
13
|
+
removeCommentOperation,
|
|
14
|
+
getIssueOperation,
|
|
15
|
+
getCommentsOperation
|
|
16
|
+
],
|
|
17
|
+
issueNumber = 1,
|
|
18
|
+
commentIdentifier = 123;
|
|
19
|
+
|
|
20
|
+
Object.assign(context, {
|
|
21
|
+
issueNumber,
|
|
22
|
+
commentIdentifier
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
sequence(operations, () => {
|
|
26
|
+
///
|
|
27
|
+
}, context);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
module.exports = removeCommentHandler;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const { issueUtilities } = require("../../.."); ///
|
|
4
|
+
|
|
5
|
+
const { alterIssuePatchRequest } = issueUtilities;
|
|
6
|
+
|
|
7
|
+
function alterIssueOperation(next, done, context) {
|
|
8
|
+
const { repository, state, issueNumber, userAgent, gitHubAccessToken } = context;
|
|
9
|
+
|
|
10
|
+
alterIssuePatchRequest(repository, state, issueNumber, userAgent, gitHubAccessToken, (error, json) => {
|
|
11
|
+
if (error) {
|
|
12
|
+
done();
|
|
13
|
+
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const { message = null } = json;
|
|
18
|
+
|
|
19
|
+
if (message !== null) {
|
|
20
|
+
done();
|
|
21
|
+
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
next();
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
module.exports = alterIssueOperation;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const { commentUtilities } = require("../../../"); ///
|
|
4
|
+
|
|
5
|
+
const { createCommentPostRequest } = commentUtilities;
|
|
6
|
+
|
|
7
|
+
function createCommentOperation(next, done, context) {
|
|
8
|
+
const { repository, description, issueNumber, userAgent, gitHubAccessToken } = context;
|
|
9
|
+
|
|
10
|
+
createCommentPostRequest(repository, description, issueNumber, userAgent, gitHubAccessToken, (error, json) => {
|
|
11
|
+
if (error) {
|
|
12
|
+
done();
|
|
13
|
+
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const { message = null } = json;
|
|
18
|
+
|
|
19
|
+
if (message !== null) {
|
|
20
|
+
done();
|
|
21
|
+
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
next();
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
module.exports = createCommentOperation;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const { issueUtilities } = require("../../.."); ///
|
|
4
|
+
|
|
5
|
+
const { createIssuePostRequest } = issueUtilities
|
|
6
|
+
|
|
7
|
+
function createIssueOperation(next, done, context) {
|
|
8
|
+
const { repository, title, description, userAgent, gitHubAccessToken } = context;
|
|
9
|
+
|
|
10
|
+
createIssuePostRequest(repository, title, description, userAgent, gitHubAccessToken, (error, json) => {
|
|
11
|
+
if (error) {
|
|
12
|
+
done();
|
|
13
|
+
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const { message = null } = json;
|
|
18
|
+
|
|
19
|
+
if (message !== null) {
|
|
20
|
+
done();
|
|
21
|
+
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const { number } = json,
|
|
26
|
+
issueNumber = number; ///
|
|
27
|
+
|
|
28
|
+
Object.assign(context, {
|
|
29
|
+
issueNumber
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
next();
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
module.exports = createIssueOperation;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const { commentUtilities } = require("../../.."); ///
|
|
4
|
+
|
|
5
|
+
const { editCommentPatchRequest } = commentUtilities;
|
|
6
|
+
|
|
7
|
+
function editCommentOperation(next, done, context) {
|
|
8
|
+
const { repository, description, commentIdentifier, userAgent, gitHubAccessToken } = context;
|
|
9
|
+
|
|
10
|
+
editCommentPatchRequest(repository, description, commentIdentifier, userAgent, gitHubAccessToken, (error, json) => {
|
|
11
|
+
if (error) {
|
|
12
|
+
done();
|
|
13
|
+
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const { message = null } = json;
|
|
18
|
+
|
|
19
|
+
if (message !== null) {
|
|
20
|
+
done();
|
|
21
|
+
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
next();
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
module.exports = editCommentOperation;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const { issueUtilities } = require("../../.."); ///
|
|
4
|
+
|
|
5
|
+
const { editIssuePatchRequest } = issueUtilities;
|
|
6
|
+
|
|
7
|
+
function editIssueOperation(next, done, context) {
|
|
8
|
+
const { repository, title, description, issueNumber, userAgent, gitHubAccessToken } = context;
|
|
9
|
+
|
|
10
|
+
editIssuePatchRequest(repository, title, description, issueNumber, userAgent, gitHubAccessToken, (error, json) => {
|
|
11
|
+
if (error) {
|
|
12
|
+
done();
|
|
13
|
+
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const { message = null } = json;
|
|
18
|
+
|
|
19
|
+
if (message !== null) {
|
|
20
|
+
done();
|
|
21
|
+
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
next();
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
module.exports = editIssueOperation;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const { commitUtilities } = require("../../.."); ///
|
|
4
|
+
|
|
5
|
+
const { baseTreeSHAGetRequest } = commitUtilities
|
|
6
|
+
|
|
7
|
+
function getBaseTreeSHAOperation(next, done, context) {
|
|
8
|
+
const { repository, userAgent, clientId, clientSecret, latestCommitSHA } = context;
|
|
9
|
+
|
|
10
|
+
baseTreeSHAGetRequest(repository, latestCommitSHA, userAgent, clientId, clientSecret, (error, json) => {
|
|
11
|
+
if (error) {
|
|
12
|
+
done();
|
|
13
|
+
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const { tree = null } = json;
|
|
18
|
+
|
|
19
|
+
if (tree === null) {
|
|
20
|
+
done();
|
|
21
|
+
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const { sha } = tree,
|
|
26
|
+
baseTreeSHA = sha; ///
|
|
27
|
+
|
|
28
|
+
Object.assign(context, {
|
|
29
|
+
baseTreeSHA
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
next();
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
module.exports = getBaseTreeSHAOperation;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const { commentUtilities } = require("../../.."); ///
|
|
4
|
+
|
|
5
|
+
const { commentsGetRequest } = commentUtilities;
|
|
6
|
+
|
|
7
|
+
function getCommentsOperation(next, done, context) {
|
|
8
|
+
const { repository, issueNumber, userAgent, clientId, clientSecret } = context;
|
|
9
|
+
|
|
10
|
+
commentsGetRequest(repository, issueNumber, userAgent, clientId, clientSecret, (error, json) => {
|
|
11
|
+
if (error) {
|
|
12
|
+
done();
|
|
13
|
+
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const { message = null } = json;
|
|
18
|
+
|
|
19
|
+
if (message !== null) {
|
|
20
|
+
done();
|
|
21
|
+
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const { issue } = context,
|
|
26
|
+
comments = json; ///
|
|
27
|
+
|
|
28
|
+
Object.assign(issue, {
|
|
29
|
+
comments
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
next();
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
module.exports = getCommentsOperation;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const { issueUtilities } = require("../../.."); ///
|
|
4
|
+
|
|
5
|
+
const { issueGetRequest } = issueUtilities;
|
|
6
|
+
|
|
7
|
+
function getIssueOperation(next, done, context) {
|
|
8
|
+
const { repository, issueNumber, userAgent, clientId, clientSecret } = context;
|
|
9
|
+
|
|
10
|
+
issueGetRequest(repository, issueNumber, userAgent, clientId, clientSecret, (error, json) => {
|
|
11
|
+
if (error) {
|
|
12
|
+
done();
|
|
13
|
+
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const { message = null } = json;
|
|
18
|
+
|
|
19
|
+
if (message !== null) {
|
|
20
|
+
done();
|
|
21
|
+
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const issue = json; ///
|
|
26
|
+
|
|
27
|
+
Object.assign(context, {
|
|
28
|
+
issue
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
next();
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
module.exports = getIssueOperation;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const { issueUtilities } = require("../../.."); ///
|
|
4
|
+
|
|
5
|
+
const { issuesGetRequest } = issueUtilities;
|
|
6
|
+
|
|
7
|
+
function getIssuesOperation(next, done, context) {
|
|
8
|
+
const { repository, state, userAgent, clientId, clientSecret } = context;
|
|
9
|
+
|
|
10
|
+
issuesGetRequest(repository, state, userAgent, clientId, clientSecret, (error, json) => {
|
|
11
|
+
if (error) {
|
|
12
|
+
done();
|
|
13
|
+
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const { message = null } = json;
|
|
18
|
+
|
|
19
|
+
if (message !== null) {
|
|
20
|
+
done();
|
|
21
|
+
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const issues = json; ///
|
|
26
|
+
|
|
27
|
+
Object.assign(context, {
|
|
28
|
+
issues
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
next();
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
module.exports = getIssuesOperation;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const { commitUtilities } = require("../../.."); ///
|
|
4
|
+
|
|
5
|
+
const { latestCommitSHAGetRequest } = commitUtilities;
|
|
6
|
+
|
|
7
|
+
function getLatestCommitSHAOperation(next, done, context) {
|
|
8
|
+
const { repository, userAgent, clientId, clientSecret } = context;
|
|
9
|
+
|
|
10
|
+
latestCommitSHAGetRequest(repository, userAgent, clientId, clientSecret, (error, json) => {
|
|
11
|
+
if (error) {
|
|
12
|
+
done();
|
|
13
|
+
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const { object = null } = json;
|
|
18
|
+
|
|
19
|
+
if (object === null) {
|
|
20
|
+
done();
|
|
21
|
+
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const { sha } = object,
|
|
26
|
+
latestCommitSHA = sha; ///
|
|
27
|
+
|
|
28
|
+
Object.assign(context, {
|
|
29
|
+
latestCommitSHA
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
next();
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
module.exports = getLatestCommitSHAOperation;
|