Skip to content

Implement GitHub Assigned PRs screen for TRMNL playlist#2

Open
bars0udin wants to merge 2 commits intomainfrom
udin/implement-github-assigned-prs-screen-for-2686
Open

Implement GitHub Assigned PRs screen for TRMNL playlist#2
bars0udin wants to merge 2 commits intomainfrom
udin/implement-github-assigned-prs-screen-for-2686

Conversation

@bars0udin
Copy link
Copy Markdown
Owner

Summary

This PR introduces a new TRMNL screen that displays GitHub pull requests assigned to the user, enabling monitoring of the PR review queue directly on the TRMNL device. The implementation leverages the existing gh CLI for authentication and data retrieval.

Key Changes

  • New Screen Module: Trmnl.Screens.GithubPrs - fetches PR data using gh pr list command, parses JSON output, and calculates relative timestamps
  • New Controller & Template: TrmnlWeb.GithubPrsController and associated Heex template optimized for the 800x480 monochrome display
  • Playlist Integration: Added the GitHub PRs screen to the playlist rotation in Trmnl.Playlist
  • Enhanced Error Handling: Updated Trmnl.Screen.render_current_bmp/1 to return {:ok, path} or {:error, reason} tuples with try/rescue blocks for exception handling
  • Bug Fix: Fixed nil value handling in Trmnl.Inventory.Device.upcase/2 to prevent errors when processing null fields

Implementation Details

  • Uses System.cmd/3 to execute gh pr list --assignee=bars0udin --state=open --json number,title,url,createdAt, avoiding manual token management
  • Parses JSON response and transforms createdAt timestamps into human-readable "time ago" strings (e.g., "3 hours ago")
  • Implements graceful degradation for empty PR lists and command execution failures
  • Screen generation pipeline now properly propagates errors with logging, improving debuggability
  • All temporary files are cleaned up even when errors occur

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant