Skip to content

About

RIM plugin: open pull requests of GitHub repositories in a panel

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

GitHub Pull Requests

A RIM plugin that lists the open pull requests of up to 10 GitHub repositories in a panel: title, author, age and whether it is a draft. It starts with the project's own repositories, rim-platform/rim-ui and rim-platform/rim-server; add and remove repositories as you like. It is a WebSandboxed plugin built on @rim-platform/plugin-sdk: it runs in a sandboxed frame of the app, on the web and on the desktop alike.

What it asks for

RIM shows the plugin as one that "Runs sandboxed in this app. It cannot read your files, run programs, or use your RIM session. It reaches RIM only through the permissions below." It asks for two permissions:

  • Render UI Panels (ui.panel), to show the list in its Pull requests panel.
  • Connect to listed sites (network.fetch), so it can send and receive data from api.github.com (the pull requests) and avatars.githubusercontent.com (the authors' pictures). The frame's content security policy blocks every other site.

Reading its own settings needs no permission. Without a token GitHub allows 60 requests an hour per IP address; with your own token, which works only in the RIM desktop app, it allows 5,000 an hour. Either way the plugin refreshes on its own every 5 minutes, at most every 2 minutes when you ask, and stops asking and says so when GitHub refuses. Your list of repositories is kept in the app's plugin store for your account on that device. Until you change it, the list is the two project repositories; a list you emptied stays empty.

A GitHub token

The plugin has one setting, GitHub token, which is optional and works only in the RIM desktop app. Open it with settings at the foot of the panel or Plugin settings in the panel's header, with Settings on the plugin's row in Settings → Plugins, or with Plugin settings: GitHub Pull Requests in the command palette.

We recommend a fine-grained personal access token with Public repositories (read-only) access and an expiry date: it raises the limit and can read nothing but public repositories. To make one:

  1. On GitHub, open Settings → Developer settings → Personal access tokens → Fine-grained tokens → Generate new token.
  2. Give it a name and an expiry date.
  3. Under Repository access, pick Public repositories. That is all the plugin needs for public repositories, and it leaves the token read-only.
  4. To list the pull requests of private repositories too, pick Only select repositories instead, with just the repositories you want, and under Permissions give Pull requests read-only access (GitHub adds Metadata read-only on its own). Their pull requests, titles and authors included, then appear in the panel for anyone who sees your screen, so choose only the ones you want there. The plugin only reads; never give the token write access.
  5. Generate the token and paste it into the field.

Where it is kept:

  • On the desktop the token is kept in the desktop app's encrypted secret vault on this device, for your account. It is never synced to another device or sent to the RIM server, the form shows only that it is set, and uninstalling the plugin deletes it. The plugin sends it only to api.github.com, as Authorization: Bearer, and never stores it or puts it in a message, the panel or the log.
  • In the web app there are no secret settings, so the field says it needs the desktop app and the plugin runs without a token there.

The plugin checks the token before it sends it: one with a space, a line break or a character outside ASCII is never sent, and the plugin fetches nothing, with or without a token, until you paste it again or clear it. When GitHub's limit is used up, the panel says what you can do: add a token in the desktop app, unlock the desktop's secret vault if it holds one that could not be read, or wait until the time it names. When GitHub rejects the token (expired, revoked), the panel says so; replace or clear it in the settings, and the plugin fetches again at once.

What it does

Command What it does
Pull requests: Refresh (refresh) Fetches the open pull requests again. Keybind capable.
Pull requests: Add repository (add_repo) Adds owner/name (or a https://github.com/owner/name link), at most 10.
Pull requests: Remove repository (remove_repo) Removes a repository.

The Pull requests panel opens next to the tool panel. Add a repository at the top, remove one with ×; r refreshes and / jumps to the field. The panel has no links: following one would navigate the panel's frame, which closes it.

Install

Each way ends the same: RIM shows the plugin and its permissions, Approve and turn on grants the ones you leave ticked and starts the plugin, and GitHub Pull Requests in the side rail's Plugins menu, or Open Pull requests in the command palette, opens its Pull requests panel.

  • Install from git URL (desktop): Settings → Plugins → Install from git URL, with https://github.com/rim-platform/plugin-github-prs.git. The desktop takes rim-plugin.json, the committed main.mjs and panels/ from the checkout and leaves the rest of the repository out.
  • Install from link (web and desktop): Settings → Plugins → Install from link, with the link a release gives: https://github.com/rim-platform/plugin-github-prs/releases/download/v<version>/chat.rim.github-prs-<version>.rimbundle#sha256=<hash>. The app checks that the bundle hashes to the value after #sha256= before it installs anything. The desktop app fetches external links through its host. The browser fetches them through its RIM server, so GitHub release links work without CORS headers. This needs an updated RIM client and server with plugin_link_fetch enabled; it is independent of workspace_plugins. An older server must be updated to install external links in the browser.
  • Workspace registry: when a workspace recommends or requires the plugin, the command palette's "Workspace plugins" offers it with its publisher's signature, and a required one is offered when the workspace opens. The app verifies the signed statement before it installs the exact version the workspace pinned.

Develop

Node 22.18 or newer.

npm ci                 # install the SDK, esbuild and the test tools
npm test               # the plugin over a MessageChannel with a pretend GitHub, and the panel in jsdom
npm run typecheck      # tsc with the strict settings plugins use
npm run lint
npm run format:check
npm run build          # bundle src/main.ts into main.mjs; commit the result
npm run check          # main.mjs and panels/ match a fresh build, as CI checks
npm run bundle         # dist/chat.rim.github-prs-<version>.rimbundle, and its sha256
rim-plugin.json   the manifest the app installs by
main.mjs          the built plugin, committed; npm run build writes it
panels/prs/       the panel page (plain HTML and JS, rendered with textContent only)
src/main.ts       the entry the build starts from
src/plugin.ts     the commands, the stored list, the refresh rules and the panel state
src/github.ts     the GitHub REST calls and what GitHub's refusals mean

A release is a tag v<version> matching the version in rim-plugin.json and package.json, with a section for it in CHANGELOG.md. CONTRIBUTING.md has the rules for a pull request.

License

Apache License 2.0, see LICENSE and NOTICE.

About

RIM plugin: open pull requests of GitHub repositories in a panel

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages