Skip to content

serpro69/linear-fetch-issues

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

7 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Linear Issues Fetcher

A simple Node.js script to fetch all issues from Linear that are assigned to you ...and export them to a YAML file.

Wait, but why? πŸ€”

Short answer: because... why not? 🀷

Long(-ish) answer: I tend to write a bunch of information in some of my issues as I work on them, especially in issues related to exploration or prototyping. Sometimes these include (semi-)valuable "lessons learned", which I might not always immediately port to my PKM/Second-Brain Vault (i.e. they get lost). And sometimes I end up trying to find these via issue search... which is far from fun. Parsing a yaml file that contains all this information is much simpler... 😏

Usage

  • Install dependencies:

    npm install
  • Get/Create your Linear API key:

  • Set the API key as an environment variable:

    export LINEAR_API_KEY=your_api_key_here
  • Run the script with npm:

    npm start
  • Or directly with node:

    node fetch-linear-issues.js
  • Profit πŸ€‘

Features

  • Fetches ALL issues assigned to you using pagination (no 50-issue limit!)
  • Includes archived issues
  • Exports to YAML file (linear-issues.yml) in the current directory
  • Issues sorted by identifier (ID) in the output file
  • Comprehensive issue data including:
    • ID and identifier
    • Title and description
    • Status (workflow state)
    • Team, project, and cycle
    • Priority
    • Labels (as array of label names)
    • Assignee
    • Estimate and due date
    • Created, updated, completed, and archived timestamps
    • Direct URL to the issue
    • Comments (with comment body, author, creation timestamp, and resolution timestamp)
  • Missing field values are explicitly set to null in YAML output
  • All comments are included (both resolved and unresolved)
  • Empty lines trimmed from beginning/end of descriptions and comment bodies

Output

The script exports all issues to a YAML file named linear-issues.yml in the current directory. Issues are sorted by their identifier using natural number sorting (e.g., ENG-1, ENG-9, ENG-10, ENG-99, ENG-100, ENG-123).

Example Console Output

πŸ” Fetching your Linear issues...

πŸ‘€ User: John Doe (john@example.com)

πŸ“₯ Fetching issues (with pagination to get all issues)...

   Fetched page 1: 100 issues (Total so far: 100)
   Fetched page 2: 50 issues (Total so far: 150)

πŸ“‹ Found 150 issue(s)

πŸ”„ Processing issues and building YAML output...

βœ… Processed 150 issues

πŸ’Ύ Output written to: /path/to/current/directory/linear-issues.yml
πŸ“Š Total issues exported: 150

Example YAML Output (linear-issues.yml)

- id: abc123-def456-ghi789
  identifier: ENG-100
  title: Old feature request
  status: Done
  team: Engineering
  priority: 1
  description: This feature was completed and archived for historical reference.
  labels:
    - enhancement
    - completed
  url: https://linear.app/team/issue/ENG-100
  assignee: John Doe
  project: null
  cycle: null
  estimate: null
  dueDate: null
  createdAt: '2025-08-15T10:00:00.000Z'
  updatedAt: '2025-09-20T10:30:00.000Z'
  completedAt: '2025-09-20T10:30:00.000Z'
  archivedAt: '2025-09-20T10:30:00.000Z'
  comments:
    - id: comment-1
      body: This looks good to me, shipping it!
      createdAt: '2025-09-20T09:00:00.000Z'
      resolvedAt: '2025-09-20T09:15:00.000Z'
      user: Jane Smith
- id: jkl012-mno345-pqr678
  identifier: ENG-123
  title: Fix login bug
  status: In Progress
  team: Engineering
  priority: 3
  description: Users are experiencing issues when logging in with SSO. The authentication flow hangs after redirecting from the identity provider.
  labels:
    - bug
    - authentication
    - high-priority
  url: https://linear.app/team/issue/ENG-123
  assignee: John Doe
  project: Authentication Improvements
  cycle: Sprint 42
  estimate: 5
  dueDate: '2025-10-15'
  createdAt: '2025-10-01T08:00:00.000Z'
  updatedAt: '2025-10-09T14:30:00.000Z'
  completedAt: null
  archivedAt: null
  comments:
    - id: comment-2
      body: I've identified the root cause. Working on a fix now.
      createdAt: '2025-10-08T10:30:00.000Z'
      resolvedAt: null
      user: John Doe
    - id: comment-3
      body: Can we prioritize this? It's blocking several users.
      createdAt: '2025-10-09T08:15:00.000Z'
      resolvedAt: null
      user: Alice Johnson
- id: stu901-vwx234-yz567
  identifier: ENG-124
  title: Add dark mode
  status: Todo
  team: Engineering
  priority: 2
  description: Implement a dark mode theme for better user experience in low-light environments.
  labels:
    - feature
    - ui
  url: https://linear.app/team/issue/ENG-124
  assignee: John Doe
  project: UI Enhancements
  cycle: null
  estimate: null
  dueDate: null
  createdAt: '2025-10-05T12:00:00.000Z'
  updatedAt: '2025-10-08T16:45:00.000Z'
  completedAt: null
  archivedAt: null
  comments: null

Pagination & Rate Limiting

The script automatically handles pagination to fetch all your issues, not just the first 50. It:

  • Fetches 100 issues per page for efficiency
  • Shows progress as it fetches each page
  • Continues until all issues are retrieved
  • Works seamlessly even if you have hundreds or thousands of issues

Optimized for Rate Limits:

  • Uses a single GraphQL query per page to fetch all data (issue details, comments, labels, etc.)
  • Avoids lazy loading which would trigger multiple API calls per issue
  • For 250 issues: only 3 API calls, 1 per page.
  • Stays well under Linear's 1,500 requests/hour limit even for thousands of issues.

Priority Levels

  • 0: None
  • 1: Low
  • 2: Medium
  • 3: High
  • 4: Urgent

About

Get all of your issues from Linear. πŸ€“ Wait, but why? πŸ€” Because... why not? 🀯

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors