Skip to content

[refactoring] Extract Discussions Data Fetch into shared component #13817

@github-actions

Description

@github-actions

Skill Overview

Create a reusable shared component for fetching GitHub Discussions data with caching, following the successful pattern established by shared/issues-data-fetch.md, shared/copilot-session-data-fetch.md, and the proposed shared/pr-data-fetch.md.

Several workflows analyze GitHub Discussions for reporting, searching, and task mining. These workflows currently implement their own discussions fetching logic. A shared component would standardize discussions data access and reduce duplication by approximately 200 lines.

Current Usage

This skill pattern appears in at least 5+ workflows that fetch or analyze discussions:

  • discussion-task-miner.md - Mines discussions for actionable tasks
  • daily-issues-report.md - Includes discussions in comprehensive reports (uses toolsets: [default, discussions])
  • weekly-issue-summary.md - Summarizes issues and discussions
  • daily-fact.md - Posts to discussions (uses toolsets: [default, discussions])
  • auto-triage-issues.md - Creates discussion reports (uses toolsets: [default, discussions])

Proposed Shared Component

File: .github/workflows/shared/discussions-data-fetch.md

Note: This shared component already exists at .github/workflows/shared/discussions-data-fetch.md but may need enhancement for broader adoption.

Current Configuration Review Needed:

---
# Need to verify if this exists and is well-documented
tools:
  cache-memory:
    key: discussions-data
  bash:
    - "gh api *"
    - "jq *"
    - "/tmp/gh-aw/jqschema.sh"
    - "mkdir *"
    - "date *"
    - "cp *"

steps:
  - name: Fetch discussions data
    env:
      GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    run: |
      # Similar pattern to issues-data-fetch.md
      # Fetch discussions using GitHub GraphQL API
      # Cache with today's date
      # Generate schema
      ...
---

Implementation Plan

  1. Verify existing component: Check if shared/discussions-data-fetch.md exists and review its implementation
  2. If exists: Enhance documentation and usage examples
  3. If doesn't exist: Create following the established pattern
  4. Add clear usage documentation with jq filtering examples
  5. Update discussion-task-miner.md to use the shared component
  6. Update daily-issues-report.md to use the shared component
  7. Progressively migrate other workflows (3+ more)
  8. Add to AGENTS.md as a reference for future workflows

Discovery Required

Before implementation, verify:

  • Does shared/discussions-data-fetch.md already exist?
  • If yes, is it actively used by workflows?
  • What's the quality of the existing implementation?
  • Does it follow the same caching pattern as issues-data-fetch.md?

Impact

  • Lines saved: ~200 lines across 5+ workflows
  • Maintenance benefit: Centralizes discussions data fetching
  • Consistency: Standardizes discussions data structure across workflows
  • Performance: Shared caching reduces API calls

Usage Example

imports:
  - shared/jqschema.md               # Required dependency
  - shared/discussions-data-fetch.md

Filtering Examples:

# Count total discussions
jq 'length' /tmp/gh-aw/discussions-data/discussions.json

# Filter by category
jq '[.[] | select(.category.name == "General")]' /tmp/gh-aw/discussions-data/discussions.json

# Filter by date range
jq --arg date "$(date -d '7 days ago' -Iseconds)" \
  '[.[] | select(.createdAt > $date)]' /tmp/gh-aw/discussions-data/discussions.json

Priority Note

PRIORITY: MEDIUM - This is lower priority than PR data fetch and workflow runs fetch because:

  1. May already exist (needs verification)
  2. Fewer workflows need discussions data compared to PRs or workflow runs
  3. Discussions API is more complex (GraphQL) and might benefit from specialized handling

Related Analysis

This recommendation comes from the Workflow Skill Extractor analysis run on 2026-02-04 analyzing 145 workflows and 58 existing shared components.

AI generated by Workflow Skill Extractor

  • expires on Feb 7, 2026, 12:06 AM UTC

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions