Skip to content

thatlittleboy/lgtm-db

Repository files navigation

~~~ LGTM db ~~~

Code style: black Ruff pre-commit Actions Status GIF count

A repository containing LGTM-related gifs and images for PR approvals and merges.

wwe-referee-thumbsup


View all the available images and gifs in the gallery page.


⬇️ Installation

This project is just for personal use, so it is not published on PyPI.

Using pipx (Python 3.8+ only) to install directly from github:

$ pipx install git+https://github.com/thatlittleboy/lgtm-db

🚀 Usage

CLI

This project exposes a simple CLI API that prints out the HTML img tag of a randomly selected gif/image in the db.

$ lgtm-db
<img alt="wwe-referee-thumbsup" src="https://c.tenor.com/JS6Vtap-SYEAAAAC/wwe-wrestling.gif" width="500" height="390">

You can then pipe the result into pbcopy etc. to copy the result into your clipboard.

WARNING: API is very much subject to change.

usage: lgtm-db [-h] [-V] [-I PATTERN] [-E PATTERN] [-wd WIDTH]

Get a randomly-generated LGTM gif or image.

optional arguments:
  -h, --help            show this help message and exit
  -V, --version         show program's version number and exit
  -I PATTERN, --include PATTERN
                        Apply an inclusive filter on the list of gifs before random choice (matches
                        are included). The filter condition is treated as a regex query if it starts
                        with ^ and ends with $. For non-regex conditions, a simple substring check is
                        used. Multiple conditions are supported. Exclusions are given higher priority
                        over inclusions.
  -E PATTERN, --exclude PATTERN
                        Apply an exclusive filter on the list of gifs before random choice (matches
                        are excluded). The filter condition is treated as a regex query if it starts
                        with ^ and ends with $. For non-regex conditions, a simple substring check is
                        used. Multiple conditions are supported. Exclusions are given higher priority
                        over inclusions.
  -wd WIDTH, --width WIDTH
                        Specify the width of the output gif. A non-positive width will result in an
                        error. Only applicable for HTML.

Browser user script

You need to install Greasemonkey / Tampermonkey, and invoke a user script to insert a random gif into the message box (upon PR approval, or any other Javascript event you like).

Sample user scripts for Gitlab and Github are found in the scripts folder.

Demo usage in Github PR

greasemonkey-demo-gh.mp4

👷 Development

Pip install in editable mode (in a virtualenv).

(venv) $ pip install -e ".[dev]"

Some personal notes on creating/editing gifs are in the Github wiki.

📌 Release

  1. Create a new branch called release-v1.10.0, for example, from the main branch.
  2. Bump the version number in __version__.py and commit with a commit message release: v1.10.0. And push up to remote.
  3. Create a PR, attach the following output
    git log --oneline --no-decorate --perl-regexp --author='^(?!.*\[bot\]).*$' HEAD ^v1.9.0
    to the PR description. Merge this branch into main.
  4. Then tag the ref, git tag v1.10.0, for example, on the main branch. Push the tags to remote.

⚡️ Inspiration

Inspiration from the following repositories: