From 42ba4086204e5c4049dc4f772dcb1cfe83f21152 Mon Sep 17 00:00:00 2001 From: Little Visions Date: Thu, 4 Dec 2025 00:21:43 +1300 Subject: [PATCH 1/3] test: Final debug test with logging --- final-debug.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 final-debug.md diff --git a/final-debug.md b/final-debug.md new file mode 100644 index 0000000..be42d50 --- /dev/null +++ b/final-debug.md @@ -0,0 +1 @@ +# Final Debug Test From a82acd04194e8d6bfe3930d72a853670fa502fcf Mon Sep 17 00:00:00 2001 From: Little Visions Date: Mon, 8 Dec 2025 17:55:57 +1300 Subject: [PATCH 2/3] fix: Remove duplicate workflow file causing double issue creation The root cause of duplicate issue creation was two workflow files (.github/workflows/gitlin.yml and .github/workflows/gitlin-bot.yml) both triggering on the same events. When `/create-issues` was posted, GitHub triggered BOTH workflows simultaneously, creating 2x issues. Changes: - Remove gitlin-bot.yml (duplicate, simpler version) - Add concurrency control to prevent race conditions from webhook retries --- .github/workflows/gitlin-bot.yml | 66 -------------------------------- .github/workflows/gitlin.yml | 5 +++ 2 files changed, 5 insertions(+), 66 deletions(-) delete mode 100644 .github/workflows/gitlin-bot.yml diff --git a/.github/workflows/gitlin-bot.yml b/.github/workflows/gitlin-bot.yml deleted file mode 100644 index 35c6a06..0000000 --- a/.github/workflows/gitlin-bot.yml +++ /dev/null @@ -1,66 +0,0 @@ -name: Gitlin - Create Linear Issues - -on: - issue_comment: - types: [created] - pull_request_review_comment: - types: [created] - -jobs: - create-issues: - # Only run if comment contains the trigger - if: contains(github.event.comment.body, '/create-issues') - runs-on: ubuntu-latest - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Setup pnpm - uses: pnpm/action-setup@v4 - with: - version: 9 - - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: "20" - cache: "pnpm" - - - name: Install dependencies - run: pnpm install --frozen-lockfile - - - name: Build - run: pnpm build - - - name: Get PR details (if PR comment) - if: github.event.issue.pull_request - id: pr - uses: actions/github-script@v7 - with: - script: | - const pr = await github.rest.pulls.get({ - owner: context.repo.owner, - repo: context.repo.repo, - pull_number: context.issue.number - }); - return { - title: pr.data.title, - body: pr.data.body || '', - number: context.issue.number - }; - - - name: Run Gitlin Bot - env: - LINEAR_API_KEY: ${{ secrets.LINEAR_API_KEY }} - LINEAR_TEAM_ID: ${{ secrets.LINEAR_TEAM_ID }} - ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - GITHUB_REPOSITORY_OWNER: ${{ github.repository_owner }} - GITHUB_REPOSITORY: ${{ github.repository }} - COMMENT_BODY: ${{ github.event.comment.body }} - PR_NUMBER: ${{ github.event.issue.pull_request && github.event.issue.number || '' }} - ISSUE_NUMBER: ${{ !github.event.issue.pull_request && github.event.issue.number || '' }} - PR_TITLE: ${{ steps.pr.outputs.result && fromJSON(steps.pr.outputs.result).title || '' }} - PR_DESCRIPTION: ${{ steps.pr.outputs.result && fromJSON(steps.pr.outputs.result).body || '' }} - run: node dist/index.js diff --git a/.github/workflows/gitlin.yml b/.github/workflows/gitlin.yml index 499fa2a..e1ca259 100644 --- a/.github/workflows/gitlin.yml +++ b/.github/workflows/gitlin.yml @@ -6,6 +6,11 @@ on: pull_request_review_comment: types: [created] +# Prevent duplicate runs for the same comment +concurrency: + group: gitlin-${{ github.event.comment.id }} + cancel-in-progress: false + jobs: create-issues: # Only run if comment contains the trigger From 482545ca944eae9d630ea556d7db34f20da93b39 Mon Sep 17 00:00:00 2001 From: Little Visions Date: Mon, 8 Dec 2025 18:02:46 +1300 Subject: [PATCH 3/3] style: Fix Prettier formatting --- src/index.ts | 8 +++++--- src/linear-client.ts | 6 ++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/index.ts b/src/index.ts index 060af47..7d0b197 100644 --- a/src/index.ts +++ b/src/index.ts @@ -108,7 +108,7 @@ export class Gitlin { } console.log( - `Collected ${allComments.length} unresolved comments (${issueComments.data.length} issue comments, ${allComments.filter(c => c.type === "review").length} unresolved review comments)`, + `Collected ${allComments.length} unresolved comments (${issueComments.data.length} issue comments, ${allComments.filter((c) => c.type === "review").length} unresolved review comments)`, ); return allComments; @@ -132,7 +132,9 @@ export class Gitlin { // Check if any issue has our tracking marker for (const issue of existingIssues) { if (issue.description?.includes(``)) { - console.log(`PR already processed - found ${existingIssues.length} existing issues`); + console.log( + `PR already processed - found ${existingIssues.length} existing issues`, + ); return true; } } @@ -181,7 +183,7 @@ export class Gitlin { comments = allComments; // Combine all comments with separators - commentBody = comments.map(c => c.body).join("\n\n---\n\n"); + commentBody = comments.map((c) => c.body).join("\n\n---\n\n"); console.log( `Analyzing ${comments.length} comments (${commentBody.length} characters)`, ); diff --git a/src/linear-client.ts b/src/linear-client.ts index f83adc3..c83ec3c 100644 --- a/src/linear-client.ts +++ b/src/linear-client.ts @@ -56,7 +56,9 @@ export class LinearClient { try { const linearIssue = await this.createIssue(issue, createdIssues, prUrl); - console.log(`[${i + 1}/${issues.length}] ✓ CREATED: ${linearIssue.identifier} - ${linearIssue.url}`); + console.log( + `[${i + 1}/${issues.length}] ✓ CREATED: ${linearIssue.identifier} - ${linearIssue.url}`, + ); result.issues.push({ title: issue.title, @@ -147,7 +149,7 @@ export class LinearClient { description += `\n\n---\n\n**Related PR:** ${prUrl}`; // Add hidden tracking marker for duplicate detection // Format: - description += `\n`; + description += `\n`; } // Refresh cache if needed