iTranslated by AI

The content below is an AI-generated translation. This is an experimental feature, and may contain errors. View original article
🐈‍⬛

Released "Github PR Mew": A Chrome Extension to Manage and Apply PR Templates

に公開

Hello. I have released my first Chrome extension, so please let me promote it.
I released "Github PR Mew".

https://chromewebstore.google.com/detail/github-pr-mew/jominaeelfdlakapmgbhacmhnbmbohaj

"Mew" is the sound a cat makes in English.
I named it this because I want it to be used by "people who are so busy they could use an extra hand" (referencing the Japanese idiom "borrowing a cat's paw"), and because "GitHub's official mascot is the Octocat (octopus + cat)," so I matched it to that.

  • If read in Japanese, it might sound like "GitHub PR Nyaa (Meow)."

Feature Overview ⚙️

① Fetches repositories using a GitHub Personal Access Token (classic).
② Fetches Markdown (.md) files under /.github from the repository.
③ Registers selected Markdown files as presets.
④ On the GitHub pull request page, it overwrites the "Add a Description" field with the content of the Markdown file selected from the presets.

  • It only reads repository content and does not perform any write operations.

About Security 🪖

To use this extension, you need a GitHub Personal Access Token (classic) with read access to the repository.
The token is encrypted and saved only in the browser's storage, not in any cloud service. Therefore, I believe you can use it with peace of mind.

Why I Created It 🤔

In the workplaces I've been involved with recently, more and more projects are adopting a "NextJS x Monorepo" architecture.
While convenient, since both the backend and frontend are in the same repository, I had to use different templates for pull requests—a frontend template (Frontend.md) for frontend changes and a backend template (Backend.md) for backend changes. Doing this required the following steps, which was a bit cumbersome:

1. Create a pull request (Open the GitHub page)
2. Reload the page after adding the query parameter &template=frontend.md to the end of the URL
3. The frontend pull request template is applied

It would be helpful if GitHub officially supported multiple pull request templates, but although issues have been raised about this for a long time, there has been no sign of them addressing it.
Since I had been wanting to try making a browser extension for a while, I decided to build it myself.
(I saw articles suggesting you could select them from a dropdown if you configured them, but that is not possible. That is misinformation.)

Technology Used 🛠️

Since I am a frontend engineer, I planned to build it using React and TypeScript, which I am comfortable with. While looking into various options, I found a framework for building browser extensions with React called "Plasmo", so I used that. I cannot compare it to not using it, but the development experience was excellent.

I had some prior knowledge about building browser extensions, so I thought, "configuring manifest.json and such seems like a pain." However, with Plasmo, those tedious configurations were unnecessary, and it helped that I could start development immediately.

Also, since I could use libraries like Zustand and Zod, I was able to develop smoothly without feeling much of a difference from my usual web development work.

🩵 For learning Plasmo, I referred to the following article by "nado".

https://zenn.dev/nado1001/articles/plasmo-browser-extension

🧡 You can find the official Plasmo documentation here.

https://docs.plasmo.com/

💜 I used the GitHub REST API to fetch GitHub repositories.

https://docs.github.com/en/rest?apiVersion=2022-11-28

I would be happy if you could give it a try and install it.

https://chromewebstore.google.com/detail/github-pr-mew/jominaeelfdlakapmgbhacmhnbmbohaj

Meow

Discussion