Skip to content

[codex] add safe automerge workflow#1

Closed
nnlevy wants to merge 1 commit intomasterfrom
chore/codex-automerge-workflow
Closed

[codex] add safe automerge workflow#1
nnlevy wants to merge 1 commit intomasterfrom
chore/codex-automerge-workflow

Conversation

@nnlevy
Copy link
Owner

@nnlevy nnlevy commented Feb 17, 2026

Verification

  • Adds .github/workflows/codex-automerge.yml
  • Adds docs/codex-workflow.md
  • Documents label meanings and automerge safety denylist
  • No runtime application code changes in this PR

Notes

This PR adds a safe automerge workflow for Codex PRs using pull_request_target.

It only applies when:

  • label automerge is present
  • PR is not a draft
  • author is chatgpt-codex-connector or head ref starts with codex/
  • changed files do not match the denylist
  • safe files are merged with squash when checks are eligible

Do not label this PR as automerge.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 30b640ee82

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

const hasAutomergeLabel = labels.includes('automerge');
const isNotDraft = pr.draft === false;
const isCodexAuthor = pr.user && pr.user.login === 'chatgpt-codex-connector';
const isCodexBranch = typeof pr.head?.ref === 'string' && pr.head.ref.startsWith('codex/');

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Restrict codex branch checks to trusted repositories

The automerge gate treats any PR whose head ref starts with codex/ as trusted (isCodexBranch), but it never verifies that the head branch comes from this repository (for example via pr.head.repo.full_name === repo.full_name). In pull_request_target with write permissions, a fork can use a codex/* branch name and satisfy this check; if a maintainer adds automerge, this workflow can merge untrusted fork code under the elevated token.

Useful? React with 👍 / 👎.

Comment on lines +57 to +60
'**/src/**/stripe*',
'**/src/**/payments*',
'**/src/**/auth*',
'**/src/**/sessions*',

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Match sensitive directory contents in denylist globs

The denylist patterns for stripe*, payments*, auth*, and sessions* only match final path segments, so edits inside those directories (for example src/auth/login.js) are not denied and can still be auto-merged. The fallback regexes on lines 72–75 have the same end-of-path limitation, so both matcher paths miss nested files in these sensitive areas.

Useful? React with 👍 / 👎.

@nnlevy
Copy link
Owner Author

nnlevy commented Feb 17, 2026

Closing duplicate rollout PR to keep single Codex automerge PR per repo.

@nnlevy nnlevy closed this Feb 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant