Skip to content

Commit d2ca8f7

Browse files
committed
Filter Linear sync by [paper2ppt] title prefix on DSC team.
Use Dschloe team with a title prefix instead of a dedicated Linear team, add .env.example, and gitignore local secrets.
1 parent 1478c1e commit d2ca8f7

7 files changed

Lines changed: 51 additions & 9 deletions

File tree

‎.env.example‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Copy to .env for local Linear/GitHub sync (never commit .env).
2+
# GitHub Actions uses repository Secrets instead — see README.
3+
4+
LINEAR_API_KEY=
5+
# Dschloe (DSC) team UUID
6+
LINEAR_TEAM_ID=
7+
# Only Linear issues whose title contains this prefix sync to GitHub.
8+
LINEAR_TITLE_PREFIX=[paper2ppt]
9+
10+
# Fine-grained PAT: Issues read/write on dschloe/paper2ppt only (e.g. paper2ppt-agent).
11+
GITHUB_TOKEN=
12+
GITHUB_REPO=dschloe/paper2ppt

‎.github/scripts/notify_linear_failure.py‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,9 @@ def graphql(query: str, variables: dict | None = None) -> dict:
7272

7373

7474
def build_title(workflow_name: str, repository: str) -> str:
75-
return f"[CI] {workflow_name} failed — {repository}"
75+
prefix = os.environ.get("LINEAR_TITLE_PREFIX", "[paper2ppt]").strip()
76+
base = f"[CI] {workflow_name} failed — {repository}"
77+
return f"{prefix} {base}" if prefix else base
7678

7779

7880
def build_description() -> str:

‎.github/scripts/sync_linear_to_github.py‎

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,12 @@ def github_request(method: str, path: str, body: dict | None = None) -> Any:
7373
return json.loads(resp.read())
7474

7575

76-
def list_linear_open_issues(team_id: str, limit: int = 50) -> list[dict]:
76+
def list_linear_open_issues(team_id: str, title_prefix: str = "", limit: int = 50) -> list[dict]:
7777
filt: dict = {"state": {"type": {"nin": ["completed", "canceled"]}}}
7878
if team_id:
7979
filt["team"] = {"id": {"eq": team_id}}
80+
if title_prefix:
81+
filt["title"] = {"contains": title_prefix}
8082

8183
issues: list[dict] = []
8284
after = None
@@ -87,7 +89,10 @@ def list_linear_open_issues(team_id: str, limit: int = 50) -> list[dict]:
8789
{"first": page_size, "after": after, "filter": filt},
8890
)
8991
conn = data["issues"]
90-
issues.extend(conn["nodes"])
92+
batch = conn["nodes"]
93+
if title_prefix:
94+
batch = [i for i in batch if title_prefix in (i.get("title") or "")]
95+
issues.extend(batch)
9196
if not conn["pageInfo"]["hasNextPage"]:
9297
break
9398
after = conn["pageInfo"]["endCursor"]
@@ -145,6 +150,7 @@ def main() -> int:
145150
api_key = os.environ.get("LINEAR_API_KEY", "").strip()
146151
token = os.environ.get("GITHUB_TOKEN", "").strip()
147152
team_id = os.environ.get("LINEAR_TEAM_ID", "").strip()
153+
title_prefix = os.environ.get("LINEAR_TITLE_PREFIX", "[paper2ppt]").strip()
148154
prefix = os.environ.get("ISSUE_TITLE_PREFIX", "[linear]").strip()
149155
dry_run = os.environ.get("DRY_RUN") == "1"
150156

@@ -153,9 +159,13 @@ def main() -> int:
153159
return 0
154160

155161
try:
156-
linear_issues = list_linear_open_issues(team_id)
162+
linear_issues = list_linear_open_issues(team_id, title_prefix=title_prefix)
157163
github_issues = list_github_open_issues()
158-
print(f"Found {len(linear_issues)} open Linear issue(s), {len(github_issues)} open GitHub issue(s)")
164+
prefix_note = f" (title contains {title_prefix!r})" if title_prefix else ""
165+
print(
166+
f"Found {len(linear_issues)} open Linear issue(s){prefix_note}, "
167+
f"{len(github_issues)} open GitHub issue(s)"
168+
)
159169

160170
for issue in linear_issues:
161171
ident = issue["identifier"]

‎.github/workflows/notify-linear-on-failure.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ jobs:
2525
env:
2626
LINEAR_API_KEY: ${{ secrets.LINEAR_API_KEY }}
2727
LINEAR_TEAM_ID: ${{ secrets.LINEAR_TEAM_ID }}
28+
LINEAR_TITLE_PREFIX: "[paper2ppt]"
2829
LINEAR_LABEL_IDS: ${{ vars.LINEAR_LABEL_IDS }}
2930
WORKFLOW_NAME: ${{ github.event.workflow_run.name }}
3031
WORKFLOW_RUN_URL: ${{ github.event.workflow_run.html_url }}

‎.github/workflows/sync-issues.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ jobs:
2020
env:
2121
LINEAR_API_KEY: ${{ secrets.LINEAR_API_KEY }}
2222
LINEAR_TEAM_ID: ${{ secrets.LINEAR_TEAM_ID }}
23+
LINEAR_TITLE_PREFIX: "[paper2ppt]"
2324
GITHUB_TOKEN: ${{ secrets.AGENT_GITHUB_TOKEN }}
2425
GITHUB_REPO: ${{ github.repository }}
2526
ISSUE_TITLE_PREFIX: "[linear]"

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
node_modules/
2+
.env
23
.DS_Store
34
*.log
45

‎README.md‎

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -472,11 +472,26 @@ This repo follows the same automation pattern as [ollama-advisor](https://github
472472

473473
| Secret | Required for | Notes |
474474
|--------|----------------|-------|
475-
| `LINEAR_API_KEY` | Linear notify + sync | Linear → Settings → API → Personal API keys |
476-
| `LINEAR_TEAM_ID` | Linear notify + sync | Team UUID in Linear |
475+
| `LINEAR_API_KEY` | Linear notify + sync | Same workspace API key is fine (e.g. reuse from other repos) |
476+
| `LINEAR_TEAM_ID` | Linear notify + sync | **Dschloe (`DSC`) team UUID** — not `ollama-advisor` (`OA`) |
477477
| `AGENT_GITHUB_TOKEN` | Sync only | Fine-grained PAT with Issues read/write on this repo |
478478

479-
Optional repository variable: `LINEAR_LABEL_IDS` (comma-separated label UUIDs for CI-created Linear issues).
479+
**Important:** Use the **Dschloe (`DSC`)** team. Prefix paper2ppt Linear issue titles with **`[paper2ppt]`** (e.g. `[paper2ppt] Fix PPTX footer`). Only those titles sync to this repo’s GitHub Issues — other DSC work stays in Linear only.
480+
481+
Optional repository variable: `LINEAR_LABEL_IDS` (comma-separated label UUIDs for extra Linear labels on CI failures).
482+
483+
| Setting | Default | Purpose |
484+
|---------|---------|---------|
485+
| `LINEAR_TITLE_PREFIX` | `[paper2ppt]` | Sync + CI issues use this title prefix |
486+
487+
### Local setup
488+
489+
Copy [`.env.example`](.env.example)`.env` and fill in the same values as Secrets (for `cursor_prompt.py` and local sync). `.env` is gitignored.
490+
491+
```bash
492+
cp .env.example .env
493+
# edit .env — DSC team ID; prefix Linear titles with [paper2ppt]
494+
```
480495

481496
### Local commands
482497

@@ -485,7 +500,7 @@ Optional repository variable: `LINEAR_LABEL_IDS` (comma-separated label UUIDs fo
485500
npm test
486501

487502
# Cursor handoff from a Linear issue (set LINEAR_API_KEY first)
488-
LINEAR_API_KEY=... LINEAR_TEAM_ID=... python .github/scripts/cursor_prompt.py P2S-12
503+
LINEAR_API_KEY=... LINEAR_TEAM_ID=... python .github/scripts/cursor_prompt.py DSC-12
489504

490505
# Dry-run Linear → GitHub sync
491506
DRY_RUN=1 LINEAR_API_KEY=... GITHUB_TOKEN=... python .github/scripts/sync_linear_to_github.py

0 commit comments

Comments
 (0)