Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,6 @@ main.js
data.json

.DS_Store

# Snyk Security Extension - AI Rules (auto-generated)
.github/instructions/snyk_rules.instructions.md
45 changes: 27 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,65 +5,74 @@ An Obsidian plugin that integrates with GitHub to track issues and pull requests

>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.

## ✨ Features
# Documentation
Check out the [documentation](https://github.com/LonoxX/obsidian-github-issues/wiki) for detailed information on setup, configuration, and usage.

### 🔄 Issue & Pull Request Tracking
## Features

### Issue & Pull Request Tracking
- Track issues and pull requests from multiple GitHub repositories
- Automatically sync GitHub data on startup (configurable)
- Background sync at configurable intervals
- Filter by labels, assignees, and reviewers
- Include or exclude closed issues/PRs
- Automatic cleanup of old closed items

### 📊 GitHub Projects v2 Integration
### GitHub Projects v2 Integration
- Track GitHub Projects across repositories
- Kanban board view for project visualization
- Custom field support (status, priority, iteration)
- Project-specific filtering and organization

### 📝 Markdown Notes
### Sub-Issues Support
- Track GitHub sub-issues (parent/child relationships)
- Display sub-issues list with status indicators
- Navigate between parent and child issues
- Progress tracking with completion percentage

### Markdown Notes
- Create markdown notes for each issue or PR
- Customizable filename templates with variables
- Custom content templates
- YAML frontmatter with metadata
- Preserve user content with persist blocks
- Include comments in notes

## 🚀 Installation
## Installation

### Via Community Plugins (Recommended)

### Via Obsidian Community Plugins
1. Open Obsidian settings
1. Open Obsidian Settings
2. Navigate to **Community Plugins**
3. Click **Browse** and search for "GitHub Issues"
4. Click **Install** and then **Enable**

### Manual Installation

1. Download the latest release from the [GitHub Releases page](https://github.com/LonoxX/obsidian-github-issues/releases).
2. Extract the contents into your Obsidian plugins folder:
`<vault>/.obsidian/plugins/github-issues/`
3. Enable the plugin in Obsidian under **Community Plugins**
4. Reload or restart Obsidian
1. Download the latest release from [GitHub Releases](https://github.com/LonoxX/obsidian-github-issues/releases)
2. Extract to `<vault>/.obsidian/plugins/github-issues/`
3. Enable the plugin in **Community Plugins**
4. Reload Obsidian

## ⚙️ Configuration

## Configuration

1. Create a new GitHub token with the `repo` and `read:org` permissions
→ [GitHub Settings > Developer Settings > Personal access tokens](https://github.com/settings/tokens)
2. Configure the plugin in Obsidian settings:
- Paste your GitHub token in the **GitHub Token** field
- Adjust additional settings as needed

## 📦 Adding Repositories
## Adding Repositories

1. Open the plugin settings in Obsidian
2. Add repositories by entering the full GitHub repository path (e.g., `lonoxx/obsidian-github-issues`),
or use the repository browser to select one or multiple repositories
3. Click **Add Repository** or **Add Selected Repositories**
4. The plugin will automatically fetch issues from the configured repositories

### ⭐ This repository if you like this project!

## Support

## 📄 License
If you find this plugin useful and would like to support its development, you can star the repository or support me on Ko-fi or [GitHub Sponsors](https://github.com/sponsors/LonoxX):

This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/LonoxX)
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@
"author": "LonoxX",
"license": "MIT",
"devDependencies": {
"@types/node": "^25.0.3",
"@typescript-eslint/eslint-plugin": "^8.52.0",
"@typescript-eslint/parser": "^8.52.0",
"@types/node": "^25.0.8",
"@typescript-eslint/eslint-plugin": "^8.53.0",
"@typescript-eslint/parser": "^8.53.0",
"builtin-modules": "^5.0.0",
"esbuild": "^0.27.2",
"eslint": "^9.39.2",
"obsidian": "latest",
"obsidian": "^1.11.4",
"tslib": "^2.8.1",
"typescript": "^5.9.3"
},
Expand Down
45 changes: 44 additions & 1 deletion src/content-generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ export class ContentGenerator {
comments: any[],
settings: GitHubTrackerSettings,
projectData?: ProjectData[],
subIssues?: any[],
parentIssue?: any,
): Promise<string> {
// Determine whether to escape hash tags (repo setting takes precedence if ignoreGlobalSettings is true)
const shouldEscapeHashTags = repo.ignoreGlobalSettings ? repo.escapeHashTags : settings.escapeHashTags;
Expand All @@ -37,7 +39,9 @@ export class ContentGenerator {
settings.dateFormat,
settings.escapeMode,
shouldEscapeHashTags,
projectData
projectData,
subIssues,
parentIssue
);
return processContentTemplate(templateContent, templateData, settings.dateFormat);
}
Expand Down Expand Up @@ -74,6 +78,24 @@ labels: [${(
updateMode: "${repo.issueUpdateMode}"
allowDelete: ${repo.allowDeleteIssue ? true : false}`;

// Add parent issue if available
if (parentIssue) {
frontmatter += `
parent_issue: ${parentIssue.number}
parent_issue_url: "${parentIssue.url}"`;
}

// Add sub-issues metadata if available
if (subIssues && subIssues.length > 0) {
const closedCount = subIssues.filter((si: any) => si.state === "closed").length;
const openCount = subIssues.length - closedCount;
frontmatter += `
sub_issues: [${subIssues.map((si: any) => si.number).join(", ")}]
sub_issues_count: ${subIssues.length}
sub_issues_open: ${openCount}
sub_issues_closed: ${closedCount}`;
}

// Add projectData if available
if (projectData && projectData.length > 0) {
frontmatter += `
Expand All @@ -96,6 +118,27 @@ ${

${this.fileHelpers.formatComments(comments, settings.escapeMode, settings.dateFormat, shouldEscapeHashTags)}`;

// Add sub-issues section if available
if (subIssues && subIssues.length > 0) {
frontmatter += `

## Sub-Issues
${subIssues.map((si: any) => {
const statusIcon = si.state === "closed"
? '<span class="github-issues-sub-issue-closed">●</span>'
: '<span class="github-issues-sub-issue-open">●</span>';
return `- ${statusIcon} [#${si.number} ${si.title}](${si.url})`;
}).join("\n")}`;
}

// Add parent issue link if available
if (parentIssue) {
frontmatter += `

## Parent Issue
- [#${parentIssue.number} ${parentIssue.title}](${parentIssue.url})`;
}

return frontmatter;
}

Expand Down
82 changes: 77 additions & 5 deletions src/file-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class FileManager {
private app: App,
private settings: GitHubTrackerSettings,
private noticeManager: NoticeManager,
gitHubClient: GitHubClient,
private gitHubClient: GitHubClient,
) {
this.issueFileManager = new IssueFileManager(app, settings, noticeManager, gitHubClient);
this.prFileManager = new PullRequestFileManager(app, settings, noticeManager, gitHubClient);
Expand Down Expand Up @@ -159,6 +159,29 @@ export class FileManager {
const repository = this.extractRepositoryFromUrl(content.url) || `${project.owner}/unknown`;
const projectData = this.convertFieldValuesToProjectData(project, status, item.fieldValues?.nodes || []);

// Fetch sub-issues and parent issue for template support (only if enabled for project)
let subIssues: any[] = [];
let parentIssue: any = null;

if (isIssue && project.includeSubIssues) {
const [owner, repoName] = repository.split("/");
if (owner && repoName) {
subIssues = await this.gitHubClient.fetchSubIssues(owner, repoName, content.number);
parentIssue = await this.gitHubClient.fetchParentIssue(owner, repoName, content.number);

// Enrich sub-issues with vault paths if they exist
const noteTemplate = project.issueNoteTemplate || "Issue - {number} - {title}";
subIssues = await this.fileHelpers.enrichSubIssuesWithVaultPaths(
subIssues,
folderPath,
noteTemplate,
repository,
this.settings.dateFormat,
this.settings.escapeMode
);
}
}

const templateData = isIssue
? createIssueTemplateData(
this.convertToIssueFormat(content),
Expand All @@ -167,7 +190,9 @@ export class FileManager {
this.settings.dateFormat,
this.settings.escapeMode,
this.settings.escapeHashTags,
[projectData]
[projectData],
subIssues,
parentIssue
)
: createPullRequestTemplateData(
this.convertToPullRequestFormat(content),
Expand All @@ -193,7 +218,9 @@ export class FileManager {
project,
status,
isIssue,
item.fieldValues?.nodes || []
item.fieldValues?.nodes || [],
subIssues,
parentIssue
);

if (existingFile && existingFile instanceof TFile) {
Expand Down Expand Up @@ -226,6 +253,8 @@ export class FileManager {
status: string,
isIssue: boolean,
fieldValues: any[],
subIssues?: any[],
parentIssue?: any,
): Promise<string> {
const shouldEscapeHashTags = this.settings.escapeHashTags;

Expand Down Expand Up @@ -255,7 +284,9 @@ export class FileManager {
this.settings.dateFormat,
this.settings.escapeMode,
shouldEscapeHashTags,
[projectData]
[projectData],
subIssues,
parentIssue
)
: createPullRequestTemplateData(
this.convertToPullRequestFormat(content),
Expand All @@ -272,7 +303,7 @@ export class FileManager {
}

// Fallback to default format
return this.generateDefaultProjectItemContent(content, project, status, isIssue, fieldValues);
return this.generateDefaultProjectItemContent(content, project, status, isIssue, fieldValues, subIssues, parentIssue);
}

/**
Expand All @@ -284,6 +315,8 @@ export class FileManager {
status: string,
isIssue: boolean,
fieldValues: any[],
subIssues?: any[],
parentIssue?: any,
): string {
const shouldEscapeHashTags = this.settings.escapeHashTags;
const dateFormat = this.settings.dateFormat;
Expand Down Expand Up @@ -327,6 +360,24 @@ project_status: "${status}"`;
requested_reviewers: [${reviewers.join(", ")}]`;
}

// Add parent issue if available
if (parentIssue) {
frontmatter += `
parent_issue: ${parentIssue.number}
parent_issue_url: "${parentIssue.url}"`;
}

// Add sub-issues metadata if available
if (subIssues && subIssues.length > 0) {
const closedCount = subIssues.filter((si: any) => si.state === "closed").length;
const openCount = subIssues.length - closedCount;
frontmatter += `
sub_issues: [${subIssues.map((si: any) => si.number).join(", ")}]
sub_issues_count: ${subIssues.length}
sub_issues_open: ${openCount}
sub_issues_closed: ${closedCount}`;
}

frontmatter += `
---

Expand All @@ -337,6 +388,27 @@ ${
: "_No description provided._"
}`;

// Add sub-issues section if available
if (subIssues && subIssues.length > 0) {
frontmatter += `

## Sub-Issues
${subIssues.map((si: any) => {
const statusIcon = si.state === "closed"
? '<span class="github-issues-sub-issue-closed">●</span>'
: '<span class="github-issues-sub-issue-open">●</span>';
return `- ${statusIcon} [#${si.number} ${si.title}](${si.url})`;
}).join("\n")}`;
}

// Add parent issue link if available
if (parentIssue) {
frontmatter += `

## Parent Issue
- [#${parentIssue.number} ${parentIssue.title}](${parentIssue.url})`;
}

return frontmatter;
}

Expand Down
Loading