Skip to content

Commit 6767bae

Browse files
committed
docs: update README for ack workflow and demo.yml changes from main
- Add separate glimpse-ack.yml workflow snippet (instant 👀 feedback, separate file to avoid 'skipped' noise on PR push checks) - Add issues: write permission to workflow examples (required for reactions) - Add success (🎉) and failure (😕) reactions to comment command flows - Remove built-in 👀 reaction mention (now handled by ack workflow) - Expand check-trigger example into full job with all permissions/reactions - Add note about issue_comment workflows only reading from main branch https://claude.ai/code/session_019RJ9vUJi3QtJ9Sj2PJc9bc
1 parent 99cffaa commit 6767bae

1 file changed

Lines changed: 119 additions & 42 deletions

File tree

README.md

Lines changed: 119 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -28,22 +28,26 @@ PR opened/updated (or /glimpse comment)
2828

2929
## Quick start
3030

31-
### 1. Add a workflow file
31+
### 1. Add the workflow files
32+
33+
Two files are recommended. The first is the main pipeline; the second gives instant 👀 feedback on `/glimpse` comments without adding noise to PR push checks.
34+
35+
> **Note:** GitHub always reads `issue_comment` workflows from the **default branch** (main). Edits on feature branches are silently ignored for comment triggers — merge to main first for those changes to take effect. Action and core code changes are fine to test on branches.
36+
37+
**`.github/workflows/git-glimpse.yml`** — the main pipeline:
3238

3339
```yaml
34-
# .github/workflows/git-glimpse.yml
3540
name: GitGlimpse
3641

3742
on:
3843
pull_request:
3944
types: [opened, synchronize]
40-
issue_comment: # needed for on-demand /glimpse comments
45+
issue_comment:
4146
types: [created]
4247

4348
jobs:
4449
demo:
4550
runs-on: ubuntu-latest
46-
# Skip issue_comment events that aren't /glimpse on a PR
4751
if: >-
4852
github.event_name == 'pull_request' ||
4953
(github.event_name == 'issue_comment' &&
@@ -52,6 +56,7 @@ jobs:
5256
permissions:
5357
pull-requests: write
5458
contents: write # required for uploading assets
59+
issues: write # required for comment reactions
5560

5661
steps:
5762
- uses: actions/checkout@v4
@@ -75,8 +80,52 @@ jobs:
7580
env:
7681
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
7782
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
83+
84+
- name: React with hooray on success
85+
if: github.event_name == 'issue_comment' && success()
86+
env:
87+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
88+
run: |
89+
gh api repos/$GITHUB_REPOSITORY/issues/comments/${{ github.event.comment.id }}/reactions \
90+
--method POST --field content=hooray || true
91+
92+
- name: React with confused on failure
93+
if: github.event_name == 'issue_comment' && failure()
94+
env:
95+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
96+
run: |
97+
gh api repos/$GITHUB_REPOSITORY/issues/comments/${{ github.event.comment.id }}/reactions \
98+
--method POST --field content=confused || true
7899
```
79100
101+
**`.github/workflows/git-glimpse-ack.yml`** — optional but recommended, reacts with 👀 within ~15–30s so the commenter knows their request was received before the heavy pipeline begins:
102+
103+
```yaml
104+
name: GitGlimpse Acknowledge
105+
106+
on:
107+
issue_comment:
108+
types: [created]
109+
110+
jobs:
111+
ack:
112+
if: >-
113+
github.event.issue.pull_request != null &&
114+
contains(github.event.comment.body, '/glimpse')
115+
runs-on: ubuntu-latest
116+
permissions:
117+
issues: write
118+
steps:
119+
- name: React with eyes
120+
env:
121+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
122+
run: |
123+
gh api repos/$GITHUB_REPOSITORY/issues/comments/${{ github.event.comment.id }}/reactions \
124+
--method POST --field content=eyes || true
125+
```
126+
127+
The ack workflow is kept separate so it never shows up as a "skipped" check on PR push events — which would add noise for non-developer reviewers.
128+
80129
### 2. Add a config file
81130

82131
```typescript
@@ -164,9 +213,7 @@ All trigger modes support `/glimpse` PR comments:
164213

165214
The command prefix is configurable via `trigger.commentCommand` (default: `/glimpse`).
166215

167-
When a `/glimpse` comment is detected, the action acknowledges with a 👀 reaction immediately.
168-
169-
> **Note:** The `issue_comment` event must be included in your workflow trigger (as shown in the quick start) for comment commands to work.
216+
> **Note:** The `issue_comment` event must be included in your workflow trigger (as shown in the quick start) for comment commands to work. Add the optional `git-glimpse-ack.yml` workflow to give commenters immediate 👀 feedback before the heavy pipeline starts.
170217

171218
---
172219

@@ -175,41 +222,71 @@ When a `/glimpse` comment is detected, the action acknowledges with a 👀 react
175222
Installing FFmpeg and Playwright Chromium takes 2–4 minutes. When using `on-demand` or `smart` mode, many PR pushes would be skipped anyway. The `check-trigger` companion action evaluates the trigger decision first, for the cost of a few seconds, so you can gate the heavy installs on the result.
176223

177224
```yaml
178-
steps:
179-
- uses: actions/checkout@v4
180-
with:
181-
fetch-depth: 0
182-
183-
- run: npm ci
184-
185-
# Lightweight check — runs in seconds
186-
- uses: DeDuckProject/git-glimpse/check-trigger@v1
187-
id: check
188-
env:
189-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
190-
191-
# Gate all heavy steps on the result
192-
- name: Install FFmpeg
193-
if: steps.check.outputs.should-run == 'true'
194-
run: sudo apt-get install -y ffmpeg
195-
196-
- name: Cache Playwright browsers
197-
if: steps.check.outputs.should-run == 'true'
198-
uses: actions/cache@v4
199-
with:
200-
path: ~/.cache/ms-playwright
201-
key: playwright-chromium-${{ hashFiles('**/package-lock.json') }}
202-
restore-keys: playwright-chromium-
203-
204-
- name: Install Playwright Chromium
205-
if: steps.check.outputs.should-run == 'true'
206-
run: npx playwright install chromium --with-deps
207-
208-
- uses: DeDuckProject/git-glimpse@v1
209-
if: steps.check.outputs.should-run == 'true'
210-
env:
211-
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
212-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
225+
jobs:
226+
demo:
227+
runs-on: ubuntu-latest
228+
if: >-
229+
github.event_name == 'pull_request' ||
230+
(github.event_name == 'issue_comment' &&
231+
github.event.issue.pull_request != null &&
232+
contains(github.event.comment.body, '/glimpse'))
233+
permissions:
234+
pull-requests: write
235+
contents: write
236+
issues: write
237+
238+
steps:
239+
- uses: actions/checkout@v4
240+
with:
241+
fetch-depth: 0
242+
ref: ${{ github.event_name == 'issue_comment' && format('refs/pull/{0}/head', github.event.issue.number) || '' }}
243+
244+
- run: npm ci
245+
246+
# Lightweight check — runs in seconds
247+
- uses: DeDuckProject/git-glimpse/check-trigger@v1
248+
id: check
249+
env:
250+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
251+
252+
# Gate all heavy steps on the result
253+
- name: Install FFmpeg
254+
if: steps.check.outputs.should-run == 'true'
255+
run: sudo apt-get install -y ffmpeg
256+
257+
- name: Cache Playwright browsers
258+
if: steps.check.outputs.should-run == 'true'
259+
uses: actions/cache@v4
260+
with:
261+
path: ~/.cache/ms-playwright
262+
key: playwright-chromium-${{ hashFiles('**/package-lock.json') }}
263+
restore-keys: playwright-chromium-
264+
265+
- name: Install Playwright Chromium
266+
if: steps.check.outputs.should-run == 'true'
267+
run: npx playwright install chromium --with-deps
268+
269+
- uses: DeDuckProject/git-glimpse@v1
270+
if: steps.check.outputs.should-run == 'true'
271+
env:
272+
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
273+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
274+
275+
- name: React with hooray on success
276+
if: github.event_name == 'issue_comment' && steps.check.outputs.should-run == 'true' && success()
277+
env:
278+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
279+
run: |
280+
gh api repos/$GITHUB_REPOSITORY/issues/comments/${{ github.event.comment.id }}/reactions \
281+
--method POST --field content=hooray || true
282+
283+
- name: React with confused on failure
284+
if: github.event_name == 'issue_comment' && failure()
285+
env:
286+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
287+
run: |
288+
gh api repos/$GITHUB_REPOSITORY/issues/comments/${{ github.event.comment.id }}/reactions \
289+
--method POST --field content=confused || true
213290
```
214291

215292
`check-trigger` outputs:

0 commit comments

Comments
 (0)