Skip to content

cadamsmith/code-mood-ring

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

21 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

code-mood-ring

A GitHub Action that analyzes commit messages and code comments in a PR diff and posts the developer's emotional state as a PR comment.

Completely useless. Highly accurate.

usage

Add this to your workflow:

name: Code Mood Ring

on:
  pull_request:
    types: [opened, synchronize]

permissions:
  pull-requests: write

jobs:
  mood-ring:
    runs-on: ubuntu-latest
    steps:
      - uses: cadamsmith/code-mood-ring@v1

That's it. No secrets. No configuration required. The standard GITHUB_TOKEN is used automatically.

what it does

On every PR open or push:

  1. Fetches all commit messages in the PR
  2. Fetches the raw diff and extracts added comment lines
  3. Runs sentiment analysis on both (AFINN word list + custom commit/code vocabulary)
  4. Blends the scores โ€” commits weighted 60%, code comments 40%
  5. Posts (or updates) a single PR comment with the diagnosis

mood tiers

score mood
< -4 ๐Ÿ”ฅ Fine. Everything Is Fine.
-4 to -2 ๐ŸŒ€ Spiraling
-2 to -1 ๐Ÿ˜ค Defeated
-1 to 0 ๐ŸŒฟ Touch Grass Immediately
0 to 1 ๐Ÿ˜ Meh
1 to 2 โ˜• Caffeinated
2 to 3 ๐ŸŽฏ In The Zone
3+ ๐Ÿ˜Œ Zen

example output

๐ŸŒก๏ธ Code Mood Ring

Mood: ๐ŸŒ€ Spiraling

The code is crying out for help in multiple formats. Both the commits and the inline comments are in a bad place.

Stability Score: โ–ˆโ–ˆโ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘ 2/10

Commits: -2.3 sentiment avg across 4 messages
Code comments: -3.1 sentiment avg across 7 comments

๐Ÿ’ฌ Most telling commit: "why does this still not work"
๐Ÿ” Most telling comment: "TODO: figure out why this is broken"

inputs

input description default
github-token Token for posting PR comments ${{ github.token }}

how it works

Sentiment scoring uses the sentiment package (AFINN-165 word list) extended with commit-specific vocabulary:

  • wtf: -4, hotfix: -3, revert: -3, hack: -2, hopefully: -2
  • release: +3, implement: +2, optimize: +2, improve: +2

Code comments are extracted from added lines (+) in the diff across languages: //, #, /*, *, <!--, --, %%, ;.

No external API calls are made. Everything runs in the GitHub Actions runner.

development

npm install          # installs deps + the husky pre-commit hook
npm test             # vitest โ€” covers src/mood.ts
npm run typecheck    # tsc --noEmit
npm run build        # bundles src/index.ts โ†’ dist/index.js via ncc

The pre-commit hook rebuilds dist/ whenever src/ changes and runs the test suite. CI runs typecheck, tests, build, and verifies the committed dist/ matches what npm run build produces.

license

MIT

About

๐Ÿ”ฎ GitHub Action: diagnoses your emotional state from PR commits and code comments.

Topics

Resources

License

Stars

Watchers

Forks

Contributors