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... π
-
Install dependencies:
npm install
-
Get/Create your Linear API key:
- Go to https://linear.app/settings/api
- Create a new Personal API Key
- Copy the 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 π€
- 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
nullin YAML output - All comments are included (both resolved and unresolved)
- Empty lines trimmed from beginning/end of descriptions and comment bodies
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).
π 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
- 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: nullThe 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.
- 0: None
- 1: Low
- 2: Medium
- 3: High
- 4: Urgent