Skip to content

Commit 5906ed7

Browse files
authored
feat: add commit comment support (#163)
1 parent 7c1a3a3 commit 5906ed7

13 files changed

Lines changed: 809 additions & 158 deletions

File tree

.github/workflows/check-dist.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Check Transpiled JavaScript
1+
name: Check dist
22

33
on:
44
pull_request:
@@ -12,8 +12,8 @@ permissions:
1212
contents: read
1313

1414
jobs:
15-
check-dist:
16-
name: Check dist/
15+
run:
16+
name: Run
1717
runs-on: ubuntu-latest
1818

1919
steps:
@@ -43,9 +43,9 @@ jobs:
4343
ls -la ./
4444
exit 1
4545
fi
46-
if [ "$(git diff --ignore-space-at-eol --text dist/ | wc -l)" -gt "0" ]; then
46+
if [ "$(git diff --ignore-space-at-eol --text dist/index.js | wc -l)" -gt "0" ]; then
4747
echo "Detected uncommitted changes after build. See status below:"
48-
git diff --ignore-space-at-eol --text dist/
48+
git diff --ignore-space-at-eol --text dist/index.js
4949
exit 1
5050
fi
5151

.github/workflows/ci.yml

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
- name: Setup Node.js
3131
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
3232
with:
33-
node-version-file: '.node-version'
33+
node-version-file: ".node-version"
3434

3535
- name: Install Dependencies
3636
run: |
@@ -51,7 +51,7 @@ jobs:
5151
name: Dogfood
5252
runs-on: ubuntu-latest
5353
permissions:
54-
contents: read
54+
contents: write
5555
pull-requests: write
5656
steps:
5757
- name: Checkout Repo
@@ -60,7 +60,7 @@ jobs:
6060
- name: Setup Node.js
6161
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
6262
with:
63-
node-version-file: '.node-version'
63+
node-version-file: ".node-version"
6464

6565
- name: Install Dependencies
6666
run: |
@@ -94,3 +94,20 @@ jobs:
9494
replace: |
9595
Goodnight
9696
🌕
97+
98+
- name: Check for dogfood commit
99+
id: dogfood-check
100+
env:
101+
GH_TOKEN: ${{ github.token }}
102+
run: |
103+
MSG=$(gh api repos/${{ github.repository }}/commits/${{ github.event.pull_request.head.sha }} --jq '.commit.message | split("\n") | .[0]')
104+
if [[ "$MSG" == dogfood:* ]]; then
105+
echo "match=true" >> "$GITHUB_OUTPUT"
106+
fi
107+
108+
- uses: ./
109+
if: steps.dogfood-check.outputs.match == 'true'
110+
with:
111+
comment-target: commit
112+
commit-sha: ${{ github.event.pull_request.head.sha }}
113+
message: 'ruff 🐶'

.gitignore

Lines changed: 4 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
1-
2-
# Ignore test runner output
3-
__tests__/runner/*
4-
!__tests__/runner/.gitkeep
5-
61
node_modules/
72

83
# Editors
94
.vscode
10-
.idea/**
115

126
# Logs
137
logs
@@ -22,56 +16,23 @@ pids
2216
*.seed
2317
*.pid.lock
2418

25-
# Directory for instrumented libs generated by jscoverage/JSCover
26-
lib-cov
27-
2819
# Coverage directory used by tools like istanbul
2920
coverage
3021

31-
# nyc test coverage
32-
.nyc_output
33-
34-
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
35-
.grunt
36-
37-
# Bower dependency directory (https://bower.io/)
38-
bower_components
39-
40-
# node-waf configuration
41-
.lock-wscript
42-
43-
# Compiled binary addons (https://nodejs.org/api/addons.html)
44-
build/Release
45-
46-
# Other Dependency directories
47-
jspm_packages/
48-
49-
# TypeScript v1 declaration files
50-
typings/
51-
5222
# Optional npm cache directory
5323
.npm
5424

55-
# Optional eslint cache
56-
.eslintcache
57-
58-
# Optional REPL history
59-
.node_repl_history
60-
6125
# Output of 'npm pack'
6226
*.tgz
6327

64-
# Yarn Integrity file
65-
.yarn-integrity
66-
6728
# dotenv environment variables file
68-
.env
69-
70-
# next.js build output
71-
.next
29+
.env*.local
7230

7331
# Build intermediate output
7432
lib/
7533

7634
# Git worktrees
7735
.worktrees/
36+
37+
# Claude's Plans
38+
docs/plans/

CONTRIBUTING.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Contributing
2+
3+
Thanks for your interest in contributing to Add PR Comment!
4+
5+
## Getting Started
6+
7+
1. Fork the repository and clone your fork
8+
2. Install dependencies: `npm ci`
9+
3. Create a feature branch: `git checkout -b feat/my-feature`
10+
11+
## Development
12+
13+
- `npm test` — run tests
14+
- `npm run check` — lint and format check
15+
- `npm run build` — bundle into `dist/index.js`
16+
17+
## Submitting Changes
18+
19+
1. Make sure tests pass and lint is clean
20+
2. Use [conventional commits](https://www.conventionalcommits.org/) for your PR title and first commit (e.g., `feat:`, `fix:`, `docs:`)
21+
3. Open a pull request against `main`
22+
23+
## Code Style
24+
25+
This project uses [Biome](https://biomejs.dev/) for linting and formatting. Run `npm run format` to auto-fix issues.
26+
27+
## Reporting Issues
28+
29+
Please open an issue on GitHub with a clear description and, if possible, a minimal reproduction.

action.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: 'Add PR Comment'
2-
description: 'Add a comment to a pull request'
2+
description: 'Add a comment to a pull request or commit'
33
inputs:
44
message:
55
description: 'The message to print.'
@@ -59,6 +59,13 @@ inputs:
5959
preformatted:
6060
description: 'Treat message text (from a file or input) as pre-formatted and place it in a codeblock.'
6161
required: false
62+
comment-target:
63+
description: 'Where to post the comment. Use "pr" for pull request/issue comments (default) or "commit" for commit comments.'
64+
default: 'pr'
65+
required: false
66+
commit-sha:
67+
description: 'The commit SHA to comment on when comment-target is "commit". Defaults to the current commit.'
68+
required: false
6269
find:
6370
description: 'A regular expression to find for replacement. Multiple lines become individual regular expressions.'
6471
replace:

0 commit comments

Comments
 (0)