Skip to content

Commit fb48c55

Browse files
authored
Merge pull request #32 from LonoxX/develop
feat: GitHub Projects integration
2 parents f7d66f8 + 17298af commit fb48c55

22 files changed

Lines changed: 4772 additions & 81 deletions

.github/dependabot.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@ version: 2
22
updates:
33
- package-ecosystem: npm
44
directory: "/"
5+
target-branch: develop
56
schedule:
6-
interval: monthly
7+
interval: weekly
78
open-pull-requests-limit: 10
89
labels:
910
- Dependencies

README.md

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,32 @@
22

33
An Obsidian plugin that integrates with GitHub to track issues and pull requests directly in your vault.
44

5-
The configurations are heavily inspired by https://github.com/schaier-io, including some specific settings. However, I had already started working on my prototype before I discovered the plugin, and had initially even given it a similar name.
5+
6+
>The configurations are heavily inspired by https://github.com/schaier-io, including some specific settings. However, I had already started working on my prototype before I discovered the plugin, and had initially even given it a similar name.
67
78
## ✨ Features
89

9-
- Track issues and pull requests from specific GitHub repositories
10-
- Automatically sync GitHub data on Obsidian startup (configurable)
11-
- Filter tracked items by assignee and reviewers
12-
- Create Markdown notes for each issue or pull request
10+
### 🔄 Issue & Pull Request Tracking
11+
- Track issues and pull requests from multiple GitHub repositories
12+
- Automatically sync GitHub data on startup (configurable)
13+
- Background sync at configurable intervals
14+
- Filter by labels, assignees, and reviewers
15+
- Include or exclude closed issues/PRs
16+
- Automatic cleanup of old closed items
17+
18+
### 📊 GitHub Projects v2 Integration
19+
- Track GitHub Projects across repositories
20+
- Kanban board view for project visualization
21+
- Custom field support (status, priority, iteration)
22+
- Project-specific filtering and organization
23+
24+
### 📝 Markdown Notes
25+
- Create markdown notes for each issue or PR
26+
- Customizable filename templates with variables
27+
- Custom content templates
28+
- YAML frontmatter with metadata
29+
- Preserve user content with persist blocks
30+
- Include comments in notes
1331

1432
## 🚀 Installation
1533

@@ -43,6 +61,9 @@ The configurations are heavily inspired by https://github.com/schaier-io, includ
4361
3. Click **Add Repository** or **Add Selected Repositories**
4462
4. The plugin will automatically fetch issues from the configured repositories
4563

64+
### ⭐ This repository if you like this project!
65+
66+
4667
## 📄 License
4768

4869
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.

package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,19 @@
1919
"author": "LonoxX",
2020
"license": "MIT",
2121
"devDependencies": {
22-
"@types/node": "^24.9.1",
23-
"@typescript-eslint/eslint-plugin": "^8.46.2",
24-
"@typescript-eslint/parser": "^8.46.2",
22+
"@types/node": "^25.0.3",
23+
"@typescript-eslint/eslint-plugin": "^8.51.0",
24+
"@typescript-eslint/parser": "^8.51.0",
2525
"builtin-modules": "^5.0.0",
26-
"esbuild": "^0.27.0",
27-
"eslint": "^9.38.0",
26+
"esbuild": "^0.27.2",
27+
"eslint": "^9.39.2",
2828
"obsidian": "latest",
2929
"tslib": "^2.8.1",
3030
"typescript": "^5.9.3"
3131
},
3232
"dependencies": {
3333
"date-fns": "^4.1.0",
34-
"octokit": "^5.0.4",
35-
"prettier": "^3.6.2"
34+
"octokit": "^5.0.5",
35+
"prettier": "^3.7.4"
3636
}
3737
}

src/content-generator.ts

Lines changed: 45 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { format } from "date-fns";
2-
import { GitHubTrackerSettings, RepositoryTracking } from "./types";
2+
import { GitHubTrackerSettings, RepositoryTracking, ProjectData } from "./types";
33
import { escapeBody, escapeYamlString } from "./util/escapeUtils";
44
import {
55
createIssueTemplateData,
@@ -21,6 +21,7 @@ export class ContentGenerator {
2121
repo: RepositoryTracking,
2222
comments: any[],
2323
settings: GitHubTrackerSettings,
24+
projectData?: ProjectData[],
2425
): Promise<string> {
2526
// Determine whether to escape hash tags (repo setting takes precedence if ignoreGlobalSettings is true)
2627
const shouldEscapeHashTags = repo.ignoreGlobalSettings ? repo.escapeHashTags : settings.escapeHashTags;
@@ -35,17 +36,19 @@ export class ContentGenerator {
3536
comments,
3637
settings.dateFormat,
3738
settings.escapeMode,
38-
shouldEscapeHashTags
39+
shouldEscapeHashTags,
40+
projectData
3941
);
4042
return processContentTemplate(templateContent, templateData, settings.dateFormat);
4143
}
4244
}
4345

4446
// Fallback to default template
45-
return `---
47+
let frontmatter = `---
4648
title: "${escapeYamlString(issue.title)}"
4749
number: ${issue.number}
48-
status: "${issue.state}"
50+
state: "${issue.state}"
51+
type: "issue"
4952
created: "${
5053
settings.dateFormat !== ""
5154
? format(new Date(issue.created_at), settings.dateFormat)
@@ -69,7 +72,19 @@ labels: [${(
6972
) || []
7073
).join(", ")}]
7174
updateMode: "${repo.issueUpdateMode}"
72-
allowDelete: ${repo.allowDeleteIssue ? true : false}
75+
allowDelete: ${repo.allowDeleteIssue ? true : false}`;
76+
77+
// Add projectData if available
78+
if (projectData && projectData.length > 0) {
79+
frontmatter += `
80+
projectData:`;
81+
for (const project of projectData) {
82+
frontmatter += `
83+
- projectId: "${project.projectId}"`;
84+
}
85+
}
86+
87+
frontmatter += `
7388
---
7489
7590
# ${escapeBody(issue.title, settings.escapeMode, false)}
@@ -79,8 +94,9 @@ ${
7994
: "No description found"
8095
}
8196
82-
${this.fileHelpers.formatComments(comments, settings.escapeMode, settings.dateFormat, shouldEscapeHashTags)}
83-
`;
97+
${this.fileHelpers.formatComments(comments, settings.escapeMode, settings.dateFormat, shouldEscapeHashTags)}`;
98+
99+
return frontmatter;
84100
}
85101

86102
/**
@@ -91,6 +107,7 @@ ${this.fileHelpers.formatComments(comments, settings.escapeMode, settings.dateFo
91107
repo: RepositoryTracking,
92108
comments: any[],
93109
settings: GitHubTrackerSettings,
110+
projectData?: ProjectData[],
94111
): Promise<string> {
95112
// Determine whether to escape hash tags (repo setting takes precedence if ignoreGlobalSettings is true)
96113
const shouldEscapeHashTags = repo.ignoreGlobalSettings ? repo.escapeHashTags : settings.escapeHashTags;
@@ -105,17 +122,19 @@ ${this.fileHelpers.formatComments(comments, settings.escapeMode, settings.dateFo
105122
comments,
106123
settings.dateFormat,
107124
settings.escapeMode,
108-
shouldEscapeHashTags
125+
shouldEscapeHashTags,
126+
projectData
109127
);
110128
return processContentTemplate(templateContent, templateData, settings.dateFormat);
111129
}
112130
}
113131

114132
// Fallback to default template
115-
return `---
133+
let frontmatter = `---
116134
title: "${escapeYamlString(pr.title)}"
117135
number: ${pr.number}
118-
status: "${pr.state}"
136+
state: "${pr.state}"
137+
type: "pr"
119138
created: "${
120139
settings.dateFormat !== ""
121140
? format(new Date(pr.created_at), settings.dateFormat)
@@ -144,7 +163,19 @@ labels: [${(
144163
) || []
145164
).join(", ")}]
146165
updateMode: "${repo.pullRequestUpdateMode}"
147-
allowDelete: ${repo.allowDeletePullRequest ? true : false}
166+
allowDelete: ${repo.allowDeletePullRequest ? true : false}`;
167+
168+
// Add projectData if available
169+
if (projectData && projectData.length > 0) {
170+
frontmatter += `
171+
projectData:`;
172+
for (const project of projectData) {
173+
frontmatter += `
174+
- projectId: "${project.projectId}"`;
175+
}
176+
}
177+
178+
frontmatter += `
148179
---
149180
150181
# ${escapeBody(pr.title, settings.escapeMode, false)}
@@ -154,7 +185,8 @@ ${
154185
: "No description found"
155186
}
156187
157-
${this.fileHelpers.formatComments(comments, settings.escapeMode, settings.dateFormat, shouldEscapeHashTags)}
158-
`;
188+
${this.fileHelpers.formatComments(comments, settings.escapeMode, settings.dateFormat, shouldEscapeHashTags)}`;
189+
190+
return frontmatter;
159191
}
160192
}

0 commit comments

Comments
 (0)