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