Skip to content

Commit 050defd

Browse files
committed
feat(workflows): integrate GitHub Models configuration in codex.yml
- Added a step to configure Codex for GitHub Models with a custom `config.toml`. - Replaced `OPENAI_API_KEY` with `GITHUB_TOKEN` for authentication. - Removed explicit `OPENAI_BASE_URL` and `--profile` flag in favor of the pre-configured GitHub Models provider. - Ensures seamless integration with GitHub-hosted model inference API.
1 parent b104dff commit 050defd

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

.github/workflows/codex.yml

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,24 @@ jobs:
2727
- name: Install Codex CLI
2828
run: npm install -g @openai/codex
2929

30+
- name: Configure Codex for GitHub Models
31+
run: |
32+
mkdir -p ~/.codex
33+
cat > ~/.codex/config.toml << 'EOF'
34+
model = "openai/gpt-4.1"
35+
model_provider = "github-models"
36+
approval_policy = "never"
37+
38+
[model_providers.github-models]
39+
name = "GitHub Models"
40+
base_url = "https://models.github.ai/inference"
41+
env_key = "GITHUB_TOKEN"
42+
wire_api = "chat"
43+
EOF
44+
3045
- name: Process issue with Codex
3146
env:
32-
OPENAI_API_KEY: ${{ secrets.GITHUB_TOKEN }}
47+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3348
ISSUE_BODY: ${{ github.event.issue.body }}
3449
ISSUE_NUMBER: ${{ github.event.issue.number }}
3550
ISSUE_TITLE: ${{ github.event.issue.title }}
@@ -40,10 +55,8 @@ jobs:
4055
BRANCH_NAME="codex/issue-$ISSUE_NUMBER"
4156
git checkout -b $BRANCH_NAME
4257
43-
export OPENAI_BASE_URL=https://models.github.ai/inference
44-
45-
# any provider string would work here, it's just so codex knows it's using a custom model
46-
codex --profile github --model openai/gpt-4.1 --full-auto "$INSTRUCTION"
58+
# Use the configured GitHub Models provider
59+
codex --full-auto "$INSTRUCTION"
4760
4861
if [[ -n $(git status --porcelain) ]]; then
4962
git config user.name "GitHub Models Codex Bot"

0 commit comments

Comments
 (0)