Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
168 commits
Select commit Hold shift + click to select a range
5c7d9e2
Add notifier tests (#4064)
pakrym-oai Sep 23, 2025
2451b19
chore: enable auto-compaction for `gpt-5-codex` (#4093)
jif-oai Sep 23, 2025
76ecbb3
Use TestCodex builder in stream retry tests (#4096)
pakrym-oai Sep 23, 2025
e0fbc11
feat: git tooling for undo (#3914)
jif-oai Sep 23, 2025
51c465b
fix: usage data tweaks (#4082)
ae-openai Sep 23, 2025
664ee07
Rate limits warning (#4075)
aibrahim-oai Sep 23, 2025
6cd5309
feat: readiness tool (#4090)
jif-oai Sep 23, 2025
b84a920
chore: compact do not modify instructions (#4088)
jif-oai Sep 23, 2025
c6e8671
Refactor codex card layout (#4069)
aibrahim-oai Sep 23, 2025
0f9a796
Use anyhow::Result in tests for error propagation (#4105)
pakrym-oai Sep 23, 2025
fdb8dad
Add exec output-schema parameter (#4079)
pakrym-oai Sep 23, 2025
8227a5b
Send limits when getting rate limited (#4102)
aibrahim-oai Sep 23, 2025
594248f
[exec] add include-plan-tool flag and print it nicely (#3461)
dylan-hurd-oai Sep 23, 2025
af37785
fix: vendor ripgrep in the npm module (#3660)
bolinfest Sep 24, 2025
9336f2b
fix: `npm publish --tag alpha` when building an alpha release (#4112)
bolinfest Sep 24, 2025
8144ddb
chore(deps): bump serde from 1.0.224 to 1.0.226 in /codex-rs (#4031)
dependabot[bot] Sep 24, 2025
3fe3b63
chore(deps): bump log from 0.4.27 to 0.4.28 in /codex-rs (#4027)
dependabot[bot] Sep 24, 2025
f7d2f3e
chore(deps): bump tempfile from 3.20.0 to 3.22.0 in /codex-rs (#4030)
dependabot[bot] Sep 24, 2025
b90eeab
nit: update auto compact to 250k (#4135)
jif-oai Sep 24, 2025
af6304c
nit: drop instruction override for auto-compact (#4137)
jif-oai Sep 24, 2025
5b910f1
chore: extract readiness in a dedicated utils crate (#4140)
jif-oai Sep 24, 2025
cb96f4f
Add Reset in for rate limits (#4111)
aibrahim-oai Sep 24, 2025
db4aa6f
nit: 350k tokens (#4156)
jif-oai Sep 24, 2025
639a6fd
chore: upgrade to Rust 1.90 (#4124)
bolinfest Sep 24, 2025
82e6597
fix: add tolerance for ambiguous behavior in `gh run list` (#4162)
bolinfest Sep 24, 2025
00c7f7a
chore: remove `once_cell` dependency from multiple crates (#4154)
htiennv Sep 24, 2025
353a5c2
chore(deps): bump unicode-width from 0.1.14 to 0.2.1 in /codex-rs (#2…
dependabot[bot] Sep 24, 2025
bffdbec
chore(deps): bump chrono from 0.4.41 to 0.4.42 in /codex-rs (#4028)
dependabot[bot] Sep 24, 2025
addc946
Simplify tool implemetations (#4160)
pakrym-oai Sep 24, 2025
7bff8df
hide the status indicator when the answer stream starts (#4101)
nornagon-openai Sep 24, 2025
6032d78
improve MCP tool call styling (#3871)
nornagon-openai Sep 24, 2025
42847ba
pageless session list (#3194)
nornagon-openai Sep 24, 2025
0e58870
adds a windows-specific method to check if a command is safe (#4119)
iceweasel-oai Sep 24, 2025
87b299a
chore: drop unused values from env_flags (#4188)
bolinfest Sep 24, 2025
e857426
Send text parameter for non-gpt-5 models (#4195)
pakrym-oai Sep 24, 2025
d1ed3a4
github: update codespell action to v2.1 in workflow (#4205)
pakrym-oai Sep 25, 2025
250b244
ref: full state refactor (#4174)
jif-oai Sep 25, 2025
e363dac
revamp /status (#4196)
aibrahim-oai Sep 25, 2025
d61dea6
feat: add support for CODEX_SECURE_MODE=1 to restrict process observa…
bolinfest Sep 25, 2025
103adcd
fix: esc w/ queued messages overwrites draft in composer (#4237)
nornagon-openai Sep 25, 2025
a0c37f5
chore: refactor attempt_stream_responses() out of stream_responses() …
bolinfest Sep 25, 2025
344d4a1
Add explicit codex exec events (#4177)
pakrym-oai Sep 25, 2025
acc2b63
Fix error message (#4204)
pakrym-oai Sep 25, 2025
4a5f05c
make tests pass cleanly in sandbox (#4067)
nornagon-openai Sep 25, 2025
affb5fc
fix bug when resizing to a smaller width (#4248)
nornagon-openai Sep 25, 2025
7355ca4
fix (#4251)
aibrahim-oai Sep 25, 2025
67aab04
[codex exec] Add item.started and support it for command execution (#…
pakrym-oai Sep 25, 2025
38c9d7d
fix typo in sandbox doc (#4256)
iceweasel-oai Sep 25, 2025
9f2ab97
Fixed login failure with API key in IDE extension when a `.codex` dir…
etraut-openai Sep 25, 2025
8e3a048
Add codex exec testing helpers (#4254)
pakrym-oai Sep 26, 2025
a10403d
Actually mount sse once (#4264)
pakrym-oai Sep 26, 2025
eb2b739
core: add potentially dangerous command check (#4211)
iceweasel-oai Sep 26, 2025
1fc3413
ref: state - 2 (#4229)
jif-oai Sep 26, 2025
0260918
Refactor the footer logic to a new file (#4259)
aibrahim-oai Sep 26, 2025
41f5d61
Move approvals to use ListSelectionView (#4275)
aibrahim-oai Sep 26, 2025
a53720e
Show exec output on success with trimmed display (#4113)
aibrahim-oai Sep 26, 2025
8797145
fix: token usage for compaction (#4281)
jif-oai Sep 26, 2025
c549481
feat: introduce responses-api-proxy (#4246)
bolinfest Sep 26, 2025
ea095e3
Add todo-list tool support (#4255)
pakrym-oai Sep 26, 2025
e555a36
[MCP] Introduce an experimental official rust sdk based mcp client (#…
gpeal Sep 26, 2025
d3f6f66
chore: dead code removal; remove frame count and stateful render help…
tibo-openai Sep 26, 2025
1fba99e
/status followup (#4304)
aibrahim-oai Sep 26, 2025
5580170
reject dangerous commands for AskForApproval::Never (#4307)
iceweasel-oai Sep 26, 2025
cc1b21e
Add turn started/completed events and correct exit code on error (#4309)
pakrym-oai Sep 26, 2025
43b63cc
update composer + user message styling (#4240)
nornagon-openai Sep 26, 2025
3a1be08
[MCP] Add experimental support for streamable HTTP MCP servers (#4317)
gpeal Sep 27, 2025
2719fdd
Add "? for shortcuts" (#4316)
aibrahim-oai Sep 27, 2025
a325469
docs: refresh README under codex-rs (#4333)
tibo-openai Sep 27, 2025
90c3a56
fix: set gpt-5-codex medium preset reasoning (#4335)
tibo-openai Sep 27, 2025
c0960c0
tui: separator above final agent message (#4324)
nornagon-openai Sep 27, 2025
5c67dc3
Edit the spacing in shortcuts (#4330)
aibrahim-oai Sep 27, 2025
6876521
fix: remove default timeout of 30s in the proxy (#4336)
bolinfest Sep 27, 2025
bcf2bc0
fix(tui): make `?` work again (#4362)
fouad-openai Sep 27, 2025
d7286e9
chore: remove model upgrade popup (#4332)
tibo-openai Sep 27, 2025
9ee6e6f
Improve update nudge (#4405)
dedrisian-oai Sep 28, 2025
43615be
chore: move pre_main_hardening() utility into its own crate (#4403)
bolinfest Sep 28, 2025
7407469
chore: lower logging level from error to info for MCP startup (#4412)
bolinfest Sep 28, 2025
9984133
chore: remove responses-api-proxy from the multitool (#4404)
bolinfest Sep 28, 2025
ff6dbff
feat: build codex-responses-api-proxy for all platforms as part of th…
bolinfest Sep 28, 2025
79e51dd
fix: clean up some minor issues with .github/workflows/ci.yml (#4408)
bolinfest Sep 28, 2025
a9d54b9
Add /review to main commands (#4416)
dedrisian-oai Sep 28, 2025
618a42a
feat: introduce npm module for codex-responses-api-proxy (#4417)
bolinfest Sep 29, 2025
c4120a2
[CODEX-3595] Remove period when copying highlighted text in iTerm (#4…
edward-bayes Sep 29, 2025
d152534
fix clear-to-end being emitted at the end of a row (#4447)
nornagon-openai Sep 29, 2025
04c1782
OpenTelemetry events (#2103)
vishnu-oai Sep 29, 2025
197f45a
[mcp-server] Expose fuzzy file search in MCP (#2677)
dylan-hurd-oai Sep 29, 2025
83a4d4d
Parse out frontmatter for custom prompts (#4456)
dedrisian-oai Sep 29, 2025
adbc38a
TypeScript SDK scaffold (#4455)
pakrym-oai Sep 29, 2025
16057e7
[Core]: add tail in the rollout data (#4461)
aibrahim-oai Sep 29, 2025
55b74c9
render • as dim (#4467)
nornagon-openai Sep 29, 2025
c81baaa
no background for /command or @file popup (#4469)
nornagon-openai Sep 29, 2025
80ccec6
Custom prompt args (numeric) (#4470)
dedrisian-oai Sep 29, 2025
98efd35
reintroduce "? for shortcuts" (#4364)
aibrahim-oai Sep 29, 2025
c64da4f
Fixes (#4458)
aibrahim-oai Sep 30, 2025
bf76258
Custom prompts begin with `/prompts:` (#4476)
dedrisian-oai Sep 30, 2025
4a80059
Add turn.failed and rename session created to thread started (#4478)
pakrym-oai Sep 30, 2025
0793030
Rakesh/support device auth (#3531)
rakesh-oai Sep 30, 2025
52e591c
Add some types and a basic test to the SDK (#4472)
pakrym-oai Sep 30, 2025
a8edc57
Add MCP tool call item to codex exec (#4481)
pakrym-oai Sep 30, 2025
ea82f86
Rename conversation to thread in codex exec (#4482)
pakrym-oai Sep 30, 2025
c09e131
Set originator for codex exec (#4485)
pakrym-oai Sep 30, 2025
27c6c5d
SDK CI (#4483)
pakrym-oai Sep 30, 2025
87a654c
Move PR-style review to top (#4486)
dedrisian-oai Sep 30, 2025
2e95e56
Update MCP docs to reference experimental RMCP client (#4422)
gpeal Sep 30, 2025
d9dbf48
fix: separate `codex mcp` into `codex mcp-server` and `codex app-serv…
bolinfest Sep 30, 2025
5b03813
Add cloud tasks (#3197)
easong-openai Sep 30, 2025
516acc0
Support model and sandbox mode in the sdk (#4503)
pakrym-oai Sep 30, 2025
3592ecb
Named args for custom prompts (#4474)
dedrisian-oai Sep 30, 2025
f6a1528
chore: prompt update to enforce good usage of apply_patch (#3846)
jif-oai Sep 30, 2025
c89b0e1
[SDK] Test that a tread can be continued with extra params (#4508)
pakrym-oai Sep 30, 2025
a534356
Wire up web search item (#4511)
pakrym-oai Sep 30, 2025
6910be3
fix: ensure every variant of ClientRequest has a params field (#4512)
bolinfest Sep 30, 2025
ddfb7eb
fix: clean up TypeScript exports (#4518)
bolinfest Sep 30, 2025
b8e1fe6
fix: enable process hardening in Codex CLI for release builds (#4521)
bolinfest Sep 30, 2025
9c25973
Delete codex proto (#4520)
pakrym-oai Sep 30, 2025
01e6503
wrap markdown at render time (#4506)
nornagon-openai Sep 30, 2025
7fc3edf
Remove legacy codex exec --json format (#4525)
pakrym-oai Oct 1, 2025
32853ec
fix: use macros to ensure request/response symmetry (#4529)
bolinfest Oct 1, 2025
8dd771d
Add executable detection and export Codex from the SDK (#4532)
pakrym-oai Oct 1, 2025
5881c0d
fix: remove mcp-types from app server protocol (#4537)
bolinfest Oct 1, 2025
349ef7e
Fix Callback URL for staging and prod environments (#4533)
rakesh-oai Oct 1, 2025
b8195a1
chore: sanbox extraction (#4286)
jif-oai Oct 1, 2025
f815157
chore: introduce publishing logic for @openai/codex-sdk (#4543)
bolinfest Oct 1, 2025
325fad1
fix: pnpm/action-setup@v4 should run before actions/setup-node@v5 (#4…
bolinfest Oct 1, 2025
dde615f
implement command safety for PowerShell commands (#4269)
iceweasel-oai Oct 1, 2025
699c121
Handle trailing backslash properly (#4559)
rakesh-oai Oct 1, 2025
d78d076
Add Updated at time in resume picker (#4468)
aibrahim-oai Oct 1, 2025
751b3b5
Show placeholder for commands with no output (#4509)
aibrahim-oai Oct 1, 2025
2f370e9
Show context window usage while tasks run (#4536)
aibrahim-oai Oct 1, 2025
400a5a9
Fall back to configured instruction files if AGENTS.md isn't availabl…
easong-openai Oct 1, 2025
8a367ef
SDK: support working directory and skipGitRepoCheck options (#4563)
pakrym-oai Oct 1, 2025
d94e8ba
feat: add --emergency-version-override option to create_github_releas…
bolinfest Oct 1, 2025
ceaba36
fix ctr-n hint (#4566)
easong-openai Oct 1, 2025
eabe187
fix: use `number` instead of `bigint` for the generated TS for Reques…
bolinfest Oct 1, 2025
609f75a
Fix hang on second oauth login attempt (#4568)
etraut-openai Oct 1, 2025
170c685
Explicit node imports (#4567)
pakrym-oai Oct 1, 2025
5d78c1e
Revert "chore: prompt update to enforce good usage of apply_patch" (#…
tibo-openai Oct 1, 2025
31102af
Add initial set of doc comments to the SDK (#4513)
pakrym-oai Oct 1, 2025
07c1db3
rework patch/exec approval UI (#4573)
nornagon-openai Oct 1, 2025
6f97ec4
canonicalize display of Agents.md paths on Windows. (#4577)
iceweasel-oai Oct 1, 2025
e899ae7
Include request ID in the error message (#4572)
pakrym-oai Oct 1, 2025
c07fb71
Store settings on the thread instead of turn (#4579)
pakrym-oai Oct 2, 2025
35c76ad
fix: update the gpt-5-codex prompt to be more explicit that it should…
gpeal Oct 2, 2025
2f6fb37
Support CODEX_API_KEY for codex exec (#4615)
pakrym-oai Oct 2, 2025
b727d3f
fix: handle JSON Schema in additionalProperties for MCP tools (#4454)
neoeinstein Oct 2, 2025
b07aafa
Fix status usage ratio (#4584)
dedrisian-oai Oct 2, 2025
ec98445
normalize key hints (#4586)
nornagon-openai Oct 2, 2025
45936f8
show "Viewed Image" when the model views an image (#4475)
nornagon-openai Oct 2, 2025
06e34d4
Make model switcher two-stage (#4178)
easong-openai Oct 2, 2025
4c566d4
Separate interactive and non-interactive sessions (#4612)
pakrym-oai Oct 2, 2025
b93cc0f
Add a separate exec doc (#4583)
pakrym-oai Oct 2, 2025
c43a561
Add issue labeler workflow (#4621)
pakrym-oai Oct 2, 2025
ed5d656
Revert "chore: sanbox extraction" (#4626)
aibrahim-oai Oct 2, 2025
f895d4c
Minor cleanup of codex exec output (#4585)
pakrym-oai Oct 2, 2025
62cc8a4
Add issue deduplicator workflow (#4628)
pakrym-oai Oct 2, 2025
25a2e15
tui: tweaks to dialog display (#4622)
nornagon-openai Oct 2, 2025
138be0f
Use GH cli to fetch current issue (#4630)
pakrym-oai Oct 2, 2025
c405d8c
Rename assistant message to agent message and fix item type field nam…
pakrym-oai Oct 2, 2025
591a8ec
Bump codex version in actions to latest (#4634)
pakrym-oai Oct 2, 2025
c0a8447
fix false "task complete" state during agent message (#4627)
nornagon-openai Oct 2, 2025
819a578
Deduplicator fixes (#4635)
pakrym-oai Oct 2, 2025
3778659
feat: write pid in addition to port to server info (#4571)
bolinfest Oct 3, 2025
310e3c3
Update issue-deduplicator.yml (#4638)
pakrym-oai Oct 3, 2025
2d6cd69
Enable codex workflows (#4636)
pakrym-oai Oct 3, 2025
1d94b91
Use supports_color in codex exec (#4633)
pakrym-oai Oct 3, 2025
9617b69
tui: • Working, 100% context dim (#4629)
nornagon-openai Oct 3, 2025
7be3b48
feat: add file name to fuzzy search response (#4619)
shijie-oai Oct 3, 2025
2134bdc
add vhs to generate gifs
pmenglund Oct 3, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .codespellrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[codespell]
# Ref: https://github.com/codespell-project/codespell#using-a-config-file
skip = .git*,vendor,*-lock.yaml,*.lock,.codespellrc,*test.ts,*.jsonl
skip = .git*,vendor,*-lock.yaml,*.lock,.codespellrc,*test.ts,*.jsonl,frame*.txt
check-hidden = true
ignore-regex = ^\s*"image/\S+": ".*|\b(afterAll)\b
ignore-words-list = ratatui,ser
28 changes: 28 additions & 0 deletions .github/dotslash-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,34 @@
"path": "codex.exe"
}
}
},
"codex-responses-api-proxy": {
"platforms": {
"macos-aarch64": {
"regex": "^codex-responses-api-proxy-aarch64-apple-darwin\\.zst$",
"path": "codex-responses-api-proxy"
},
"macos-x86_64": {
"regex": "^codex-responses-api-proxy-x86_64-apple-darwin\\.zst$",
"path": "codex-responses-api-proxy"
},
"linux-x86_64": {
"regex": "^codex-responses-api-proxy-x86_64-unknown-linux-musl\\.zst$",
"path": "codex-responses-api-proxy"
},
"linux-aarch64": {
"regex": "^codex-responses-api-proxy-aarch64-unknown-linux-musl\\.zst$",
"path": "codex-responses-api-proxy"
},
"windows-x86_64": {
"regex": "^codex-responses-api-proxy-x86_64-pc-windows-msvc\\.exe\\.zst$",
"path": "codex-responses-api-proxy.exe"
},
"windows-aarch64": {
"regex": "^codex-responses-api-proxy-aarch64-pc-windows-msvc\\.exe\\.zst$",
"path": "codex-responses-api-proxy.exe"
}
}
}
}
}
18 changes: 18 additions & 0 deletions .github/prompts/issue-deduplicator.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
You are an assistant that triages new GitHub issues by identifying potential duplicates.

You will receive the following JSON files located in the current working directory:
- `codex-current-issue.json`: JSON object describing the newly created issue (fields: number, title, body).
- `codex-existing-issues.json`: JSON array of recent issues (each element includes number, title, body, createdAt).

Instructions:
- Load both files as JSON and review their contents carefully. The codex-existing-issues.json file is large, ensure you explore all of it.
- Compare the current issue against the existing issues to find up to five that appear to describe the same underlying problem or request.
- Only consider an issue a potential duplicate if there is a clear overlap in symptoms, feature requests, reproduction steps, or error messages.
- Prioritize newer issues when similarity is comparable.
- Ignore pull requests and issues whose similarity is tenuous.
- When unsure, prefer returning fewer matches.

Output requirements:
- Respond with a JSON array of issue numbers (integers), ordered from most likely duplicate to least.
- Include at most five numbers.
- If you find no plausible duplicates, respond with `[]`.
26 changes: 26 additions & 0 deletions .github/prompts/issue-labeler.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
You are an assistant that reviews GitHub issues for the repository.

Your job is to choose the most appropriate existing labels for the issue described later in this prompt.
Follow these rules:
- Only pick labels out of the list below.
- Prefer a small set of precise labels over many broad ones.
- If none of the labels fit, respond with an empty JSON array: []
- Output must be a JSON array of label names (strings) with no additional commentary.

Labels to apply:
1. bug — Reproducible defects in Codex products (CLI, VS Code extension, web, auth).
2. enhancement — Feature requests or usability improvements that ask for new capabilities, better ergonomics, or quality-of-life tweaks.
3. extension — VS Code (or other IDE) extension-specific issues.
4. windows-os — Bugs or friction specific to Windows environments (PowerShell behavior, path handling, copy/paste, OS-specific auth or tooling failures).
5. mcp — Topics involving Model Context Protocol servers/clients.
6. codex-web — Issues targeting the Codex web UI/Cloud experience.
8. azure — Problems or requests tied to Azure OpenAI deployments.
9. documentation — Updates or corrections needed in docs/README/config references (broken links, missing examples, outdated keys, clarification requests).
10. model-behavior — Undesirable LLM behavior: forgetting goals, refusing work, hallucinating environment details, quota misreports, or other reasoning/performance anomalies.

Issue information is available in environment variables:

ISSUE_NUMBER
ISSUE_TITLE
ISSUE_BODY
REPO_FULL_NAME
25 changes: 21 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: ci

on:
pull_request: { branches: [main] }
pull_request: {}
push: { branches: [main] }

jobs:
Expand All @@ -27,12 +27,29 @@ jobs:
- name: Install dependencies
run: pnpm install --frozen-lockfile

# Run all tasks using workspace filters
# stage_npm_packages.py requires DotSlash when staging releases.
- uses: facebook/install-dotslash@v2

- name: Ensure staging a release works.
- name: Stage npm package
id: stage_npm_package
env:
GH_TOKEN: ${{ github.token }}
run: ./codex-cli/scripts/stage_release.sh
run: |
set -euo pipefail
CODEX_VERSION=0.40.0
OUTPUT_DIR="${RUNNER_TEMP}"
python3 ./scripts/stage_npm_packages.py \
--release-version "$CODEX_VERSION" \
--package codex \
--output-dir "$OUTPUT_DIR"
PACK_OUTPUT="${OUTPUT_DIR}/codex-npm-${CODEX_VERSION}.tgz"
echo "pack_output=$PACK_OUTPUT" >> "$GITHUB_OUTPUT"

- name: Upload staged npm package artifact
uses: actions/upload-artifact@v4
with:
name: codex-npm-staging
path: ${{ steps.stage_npm_package.outputs.pack_output }}

- name: Ensure root README.md contains only ASCII and certain Unicode code points
run: ./scripts/asciicheck.py README.md
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/codespell.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ jobs:
- name: Annotate locations with typos
uses: codespell-project/codespell-problem-matcher@b80729f885d32f78a716c2f107b4db1025001c42 # v1
- name: Codespell
uses: codespell-project/actions-codespell@406322ec52dd7b488e48c1c4b82e2a8b3a1bf630 # v2
uses: codespell-project/actions-codespell@406322ec52dd7b488e48c1c4b82e2a8b3a1bf630 # v2.1
with:
ignore_words_file: .codespellignore
skip: frame*.txt
196 changes: 196 additions & 0 deletions .github/workflows/generate-vhs-gifs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,196 @@
name: Render VHS GIFs

on:
workflow_dispatch:
push:
paths:
- 'docs/tapes/**'
- '.github/workflows/generate-vhs-gifs.yml'
pull_request:
paths:
- 'docs/tapes/**'
- '.github/workflows/generate-vhs-gifs.yml'

jobs:
render-gifs:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Ensure GIF output directory exists
run: mkdir -p docs/gifs

- name: Setup FFmpeg
uses: FedericoCarboni/setup-ffmpeg@v3

- run: sudo apt-get update && sudo apt-get install -y ttyd

- uses: actions/setup-go@v6
with:
go-version: '1.25'
- run: go install github.com/charmbracelet/vhs@v0.10.0
- run: $(go env GOPATH)/bin/vhs ./docs/tapes/*.tape

- name: Upload GIFs artifact
if: always()
uses: actions/upload-artifact@v4
with:
name: vhs-gifs
path: docs/gifs
if-no-files-found: warn

comment-on-pr:
needs: render-gifs
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- name: Download GIFs artifact
id: download-artifacts
uses: actions/download-artifact@v4
with:
name: vhs-gifs
path: gifs
continue-on-error: true

- name: Build PR comment with GIFs
env:
DOWNLOAD_OUTCOME: ${{ steps.download-artifacts.outcome }}
run: |
set -euo pipefail
mkdir -p gifs
shopt -s nullglob
gifs=(gifs/*.gif)
{
echo "<!-- vhs-gifs-comment -->"
echo "## Rendered VHS GIFs"
echo
if [ "${DOWNLOAD_OUTCOME}" != "success" ]; then
echo "No GIF artifacts were available for this run."
elif [ "${#gifs[@]}" -eq 0 ]; then
echo "No GIFs were generated."
else
for gif in "${gifs[@]}"; do
filename=$(basename "${gif}")
base64_data=$(base64 -w0 "${gif}")
echo "<details>"
echo "<summary>${filename}</summary>"
echo
echo "![${filename}](data:image/gif;base64,${base64_data})"
echo
echo "</details>"
echo
done
fi
} > vhs_comment.md

- name: Find existing VHS comment
id: find-vhs-comment
uses: peter-evans/find-comment@v3
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: '<!-- vhs-gifs-comment -->'

- name: Comment on PR with GIFs
uses: peter-evans/create-or-update-comment@v5
with:
issue-number: ${{ github.event.pull_request.number }}
comment-id: ${{ steps.find-vhs-comment.outputs.comment-id }}
body-path: vhs_comment.md

comment-on-commit:
needs: render-gifs
runs-on: ubuntu-latest
if: github.event_name == 'pull_request' || github.event_name == 'push'
steps:
- name: Download GIFs artifact
id: download-artifacts
uses: actions/download-artifact@v4
with:
name: vhs-gifs
path: gifs
continue-on-error: true

- name: Build commit comment with GIFs
env:
DOWNLOAD_OUTCOME: ${{ steps.download-artifacts.outcome }}
run: |
set -euo pipefail
mkdir -p gifs
shopt -s nullglob
gifs=(gifs/*.gif)
{
echo "<!-- vhs-gifs-comment -->"
echo "## Rendered VHS GIFs"
echo
if [ "${DOWNLOAD_OUTCOME}" != "success" ]; then
echo "No GIF artifacts were available for this run."
elif [ "${#gifs[@]}" -eq 0 ]; then
echo "No GIFs were generated."
else
for gif in "${gifs[@]}"; do
filename=$(basename "${gif}")
base64_data=$(base64 -w0 "${gif}")
echo "<details>"
echo "<summary>${filename}</summary>"
echo
echo "![${filename}](data:image/gif;base64,${base64_data})"
echo
echo "</details>"
echo
done
fi
} > vhs_comment.md

- name: Determine commit SHA
id: commit-sha
run: |
set -euo pipefail
if [ "${GITHUB_EVENT_NAME}" = "pull_request" ] && [ -n "${PULL_REQUEST_SHA}" ]; then
echo "sha=${PULL_REQUEST_SHA}" >> "$GITHUB_OUTPUT"
else
echo "sha=${GITHUB_SHA}" >> "$GITHUB_OUTPUT"
fi
env:
GITHUB_EVENT_NAME: ${{ github.event_name }}
PULL_REQUEST_SHA: ${{ github.event.pull_request.head.sha || '' }}
GITHUB_SHA: ${{ github.sha }}

- name: Find existing commit comment
id: find-commit-comment
run: |
set -euo pipefail
comment_id=""
if [ -n "${COMMIT_SHA}" ]; then
comment_id=$(gh api repos/${GITHUB_REPOSITORY}/commits/${COMMIT_SHA}/comments \
--jq 'map(select(.body | contains("<!-- vhs-gifs-comment -->"))) | .[0].id // empty' || true)
fi
if [ -n "${comment_id}" ]; then
echo "comment-id=${comment_id}" >> "$GITHUB_OUTPUT"
fi
env:
COMMIT_SHA: ${{ steps.commit-sha.outputs.sha }}
GITHUB_REPOSITORY: ${{ github.repository }}
GH_TOKEN: ${{ github.token }}

- name: Upsert commit comment with GIFs
if: steps.find-commit-comment.outputs.comment-id != ''
uses: peter-evans/create-or-update-comment@v5
with:
token: ${{ github.token }}
comment-id: ${{ steps.find-commit-comment.outputs.comment-id }}
body-path: vhs_comment.md

- name: Create commit comment with GIFs
if: steps.find-commit-comment.outputs.comment-id == '' && steps.commit-sha.outputs.sha != ''
env:
COMMIT_SHA: ${{ steps.commit-sha.outputs.sha }}
GITHUB_REPOSITORY: ${{ github.repository }}
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
gh api repos/${GITHUB_REPOSITORY}/commits/${COMMIT_SHA}/comments \
-X POST \
-F body=@vhs_comment.md > /dev/null
Loading
Loading