.claude/skills/openai-codex-cli-github-actions/SKILL.md
Configure OpenAI Codex CLI (@openai/codex) for automated PR reviews in GitHub Actions. Use when: (1) Getting "401 Missing bearer or basic authentication" errors, (2) Error "the argument '--base <BRANCH>' cannot be used with '[PROMPT]'", (3) Error "--commit cannot be used with --base", (4) Codex review not authenticating despite OPENAI_API_KEY secret being set. Covers the required login step and correct argument combinations.
npx skillsauth add Dbochman/dotfiles openai-codex-cli-github-actionsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Setting up the OpenAI Codex CLI (@openai/codex) for automated PR reviews in GitHub
Actions fails with authentication errors or argument conflicts, even when OPENAI_API_KEY
is properly configured as a repository secret.
You'll hit this when:
401 Missing bearer or basic authentication in headerthe argument '--base <BRANCH>' cannot be used with '[PROMPT]'the argument '--commit <SHA>' cannot be used with: --base <BRANCH>OPENAI_API_KEY secret is set but reviews still fail with auth errorsThe Codex CLI does NOT automatically use OPENAI_API_KEY environment variable. You must
explicitly log in by piping the key to stdin:
- name: Run Codex review
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
run: |
# REQUIRED: Authenticate before running review
echo "$OPENAI_API_KEY" | codex login --with-api-key
# Now run the review
codex review --base origin/main --title "PR Title"
The codex review command has mutually exclusive options:
| Use Case | Command |
|----------|---------|
| Review PR diff against base | codex review --base origin/main |
| Review specific commit | codex review --commit <SHA> |
| Review uncommitted changes | codex review --uncommitted |
Cannot combine:
--base with --commit--base with custom [PROMPT] argument (remove the prompt)name: Codex PR Review
on:
pull_request:
branches: [main]
jobs:
review:
runs-on: ubuntu-latest
permissions:
pull-requests: write
contents: read
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install Codex CLI
run: npm install -g @openai/codex
- name: Run Codex review
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
run: |
echo "$OPENAI_API_KEY" | codex login --with-api-key
codex review \
--base origin/${{ github.base_ref }} \
--title "${{ github.event.pull_request.title }}" \
> review_output.txt 2>&1 || true
- name: Post comment
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr comment ${{ github.event.pull_request.number }} \
--body-file review_output.txt
Reading API key from stdin... Successfully logged inmodel: gpt-5.2-codex and actual code analysis| Mistake | Result | Fix |
|---------|--------|-----|
| Missing login step | 401 Unauthorized | Add echo "$KEY" \| codex login --with-api-key |
| Using --base + --commit | Argument conflict error | Use only one |
| Adding custom prompt with --base | Argument conflict error | Remove the prompt |
| Expecting OPENAI_API_KEY env to work automatically | 401 error | Must explicitly login |
gpt-5.2-codexfetch-depth: 0 is required for --base to work (needs git history)npx @openai/codex --helpdevelopment
Search the web for current information, news, facts, and answers. Use when asked questions about current events, needing to look something up, finding websites, researching topics, or when you need up-to-date information beyond your training data.
development
Summarize any URL, YouTube video, podcast, PDF, or file into concise text. Use when asked to read an article, summarize a link, get the gist of a video or podcast, extract content from a URL, or when you need to understand what a web page or document contains.
development
Play music via Spotify and control Google Home speakers. Use when asked to play music, songs, artists, playlists, podcasts, or control speakers/volume/audio.
testing
Create new OpenClaw skills, modify and improve existing skills, and measure skill performance with evals. Use when users want to create a skill from scratch, update or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy. Also use when asked to "make a skill", "turn this into a skill", "improve this skill", or "test this skill".