@polka-codes/github 0.7.9 → 0.7.11
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 +78 -0
- package/dist/index.js +6 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# Polka Codes GitHub
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@polka-codes/github)
|
|
4
|
+
[](https://www.npmjs.com/package/@polka-codes/github)
|
|
5
|
+
[](https://github.com/polkacodes/polkacodes/blob/main/LICENSE)
|
|
6
|
+
|
|
7
|
+
GitHub API integration module for Polka Codes framework.
|
|
8
|
+
|
|
9
|
+
## Features
|
|
10
|
+
|
|
11
|
+
- Fetch GitHub issues with their details and comments
|
|
12
|
+
- Fetch GitHub pull requests with their details, diffs, comments, and reviews
|
|
13
|
+
- Process GitHub markdown content by removing HTML comments and Polka Codes specific markers
|
|
14
|
+
- GraphQL integration with GitHub API
|
|
15
|
+
- Markdown processing and transformation
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
bun add @polka-codes/github
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
### Fetching an Issue
|
|
26
|
+
|
|
27
|
+
```typescript
|
|
28
|
+
import { fetchIssue } from '@polka-codes/github';
|
|
29
|
+
import { Octokit } from '@octokit/core';
|
|
30
|
+
|
|
31
|
+
const octokit = new Octokit({ auth: 'your-github-token' });
|
|
32
|
+
|
|
33
|
+
const issueText = await fetchIssue({
|
|
34
|
+
octokit,
|
|
35
|
+
owner: 'owner-name',
|
|
36
|
+
repo: 'repo-name',
|
|
37
|
+
issueNumber: 123
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
console.log(issueText);
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Fetching a Pull Request
|
|
44
|
+
|
|
45
|
+
```typescript
|
|
46
|
+
import { fetchPR } from '@polka-codes/github';
|
|
47
|
+
import { Octokit } from '@octokit/core';
|
|
48
|
+
|
|
49
|
+
const octokit = new Octokit({ auth: 'your-github-token' });
|
|
50
|
+
|
|
51
|
+
const prText = await fetchPR({
|
|
52
|
+
octokit,
|
|
53
|
+
owner: 'owner-name',
|
|
54
|
+
repo: 'repo-name',
|
|
55
|
+
prNumber: 456
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
console.log(prText);
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Development
|
|
62
|
+
|
|
63
|
+
### Building
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
cd packages/github
|
|
67
|
+
bun run build
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Testing
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
bun test
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
*This README was generated by polka.codes*
|
package/dist/index.js
CHANGED
|
@@ -57,6 +57,9 @@ ${issueBody}
|
|
|
57
57
|
continue;
|
|
58
58
|
}
|
|
59
59
|
const commentBody = await processBody(comment.body);
|
|
60
|
+
if (commentBody.trim().length === 0) {
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
60
63
|
const author = comment.author?.login ?? "unknown";
|
|
61
64
|
text += `${comment.createdAt} @${author}:
|
|
62
65
|
${commentBody}
|
|
@@ -102,6 +105,9 @@ ${diff.data}
|
|
|
102
105
|
continue;
|
|
103
106
|
}
|
|
104
107
|
const commentBody = await processBody(comment.body);
|
|
108
|
+
if (commentBody.trim().length === 0) {
|
|
109
|
+
continue;
|
|
110
|
+
}
|
|
105
111
|
const author = comment.author?.login ?? "unknown";
|
|
106
112
|
text += `${comment.createdAt} @${author}:
|
|
107
113
|
${commentBody}
|