Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 85 additions & 0 deletions .github/workflows/codex-update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Codex Update

on:
schedule:
- cron: '0 9 * * *'
workflow_dispatch:
push:
branches:
- ish/codex-autoupdate

env:
CODEX_PACKAGE: '@openai/codex'

jobs:
check:
runs-on: ubuntu-latest
outputs:
should_update: ${{ steps.check.outputs.should_update }}
version: ${{ steps.check.outputs.version }}
branch: ${{ steps.check.outputs.branch }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Check if update is required
id: check
run: |
if ! npm outdated ${{ env.CODEX_PACKAGE }}; then
echo "Package is up to date"
exit 0
fi

LATEST=$(npm view ${{ env.CODEX_PACKAGE }} version)
BRANCH="codex-update/$LATEST"

if git ls-remote --exit-code --heads origin "refs/heads/$BRANCH" >/dev/null 2>&1; then
echo "Branch $BRANCH already exists"
exit 0
fi

echo "version=$LATEST" >> $GITHUB_OUTPUT
echo "branch=$BRANCH" >> $GITHUB_OUTPUT
echo "should_update=true" >> $GITHUB_OUTPUT

update:
needs: check
if: needs.check.outputs.should_update == 'true'
runs-on: ubuntu-latest
env:
BRANCH: ${{ needs.check.outputs.branch }}
VERSION: ${{ needs.check.outputs.version }}
steps:
- uses: actions/checkout@v4

- name: Configure git user and prepare branch
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git checkout -b "${{ env.BRANCH }}"

- name: Install new version of package and commit
run: |
npm install ${{ env.CODEX_PACKAGE }}@${{ env.VERSION }}
npm run generate-types
git add package.json package-lock.json src/app-server
git commit -m "Update codex to ${{ env.VERSION }}"
git push origin "${{ env.BRANCH }}"

- name: Generate GitHub App token
id: app-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ vars.GH_APP_ID }}
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}

- name: Create PR
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
run: |
gh pr create \
--base main \
--title "Update codex to ${{ env.VERSION }}" \
--body "[What's new](https://github.com/openai/codex/releases/tag/rust-v${{ env.VERSION }})" \
--label "codex-update"
56 changes: 28 additions & 28 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"license": "ISC",
"type": "module",
"devDependencies": {
"@openai/codex": "^0.99.0",
"@openai/codex": "^0.105.0",
"@types/node": "^24.10.1",
"mcp-hello-world": "^1.1.2",
"tsx": "^4.20.6",
Expand Down
3 changes: 2 additions & 1 deletion src/app-server/AgentMessageEvent.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// GENERATED CODE! DO NOT MODIFY BY HAND!

// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { MessagePhase } from "./MessagePhase";

export type AgentMessageEvent = { message: string, };
export type AgentMessageEvent = { message: string, phase: MessagePhase | null, };
4 changes: 2 additions & 2 deletions src/app-server/ApplyPatchApprovalParams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import type { ThreadId } from "./ThreadId";

export type ApplyPatchApprovalParams = { conversationId: ThreadId,
/**
* Use to correlate this with [codex_core::protocol::PatchApplyBeginEvent]
* and [codex_core::protocol::PatchApplyEndEvent].
* Use to correlate this with [codex_protocol::protocol::PatchApplyBeginEvent]
* and [codex_protocol::protocol::PatchApplyEndEvent].
*/
callId: string, fileChanges: { [key in string]?: FileChange },
/**
Expand Down
3 changes: 2 additions & 1 deletion src/app-server/AskForApproval.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
// GENERATED CODE! DO NOT MODIFY BY HAND!

// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { RejectConfig } from "./RejectConfig";

/**
* Determines the conditions under which the user is consulted to approve
* running the command proposed by Codex.
*/
export type AskForApproval = "untrusted" | "on-failure" | "on-request" | "never";
export type AskForApproval = "untrusted" | "on-failure" | "on-request" | { "reject": RejectConfig } | "never";
Loading
Loading