-
Notifications
You must be signed in to change notification settings - Fork 87
ci: add condition on codex trigger to avoid error #252
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughAdds a conditional to the Codex GitHub Actions job so it runs only for workflow_dispatch events or when the event includes one of the labels: codex-review, codex-attempt, or codex-triage. No other job configuration changed. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant GH as GitHub Event
participant WF as Workflow: codex.yml
participant JOB as Job: codex
GH->>WF: Trigger (push/PR/label/workflow_dispatch)
WF->>JOB: Evaluate condition
alt Allowed triggers/labels
Note over JOB: event is workflow_dispatch<br/>OR labels include codex-review / codex-attempt / codex-triage
JOB->>JOB: Run steps (unchanged)
else Not allowed
Note over JOB: Skip job
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. ✨ Finishing Touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
|||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (2)
.github/workflows/codex.yml (2)
26-26: Pin the action to a commit SHA for supply-chain safety.Using @main is mutable and risky for CI determinism. Pin to a vetted commit or a trusted tag.
- uses: openai/codex/.github/actions/codex@main + uses: openai/codex/.github/actions/codex@<commit-sha>Replace with the exact commit you trust.
14-17: Confirm least-privilege permissions.contents: write may be broader than needed if the action only comments on issues/PRs. If pushes aren’t required, reduce to contents: read.
permissions: - contents: write + contents: read issues: write pull-requests: writePlease verify the Codex action’s requirements before changing.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
.github/workflows/codex.yml(1 hunks)
|
|
||
| jobs: | ||
| codex: | ||
| if: github.event_name == 'workflow_dispatch' || github.event.label.name == 'codex-review' || github.event.label.name == 'codex-attempt' || github.event.label.name == 'codex-triage' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Make label gating action-safe and actually enable manual runs.
- workflow_dispatch will never trigger because it’s not listed under on:.
- Guard github.event.label.name behind action == 'labeled' so issues.opened events don’t evaluate a missing label field.
Apply:
on:
+ workflow_dispatch:
issues:
types: [opened, labeled]
pull_request:
branches: [main]
types: [labeled]
jobs:
codex:
- if: github.event_name == 'workflow_dispatch' || github.event.label.name == 'codex-review' || github.event.label.name == 'codex-attempt' || github.event.label.name == 'codex-triage'
+ if: |
+ github.event_name == 'workflow_dispatch' ||
+ (github.event.action == 'labeled' &&
+ contains(fromJSON('["codex-review","codex-attempt","codex-triage"]'), github.event.label.name))Also applies to: 3-9
🤖 Prompt for AI Agents
.github/workflows/codex.yml around line 12 (also apply same fix to lines 3-9):
the if condition uses github.event_name == 'workflow_dispatch' which will never
be true because workflow_dispatch isn't declared under on:, and it checks
github.event.label.name without ensuring the event is 'labeled' which can cause
issues for other events; update the workflow to include workflow_dispatch under
on: so manual runs are allowed, and change the if to gate label checks behind
github.event_name == 'labeled' (e.g. github.event_name == 'workflow_dispatch' ||
(github.event_name == 'labeled' && (github.event.label.name == 'codex-review' ||
github.event.label.name == 'codex-attempt' || github.event.label.name ==
'codex-triage'))), then apply the same corrections to the other condition blocks
on lines 3-9.
|
🎉 This PR is included in version 2.7.1 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
User description
only trigger for right label
PR Type
Other
Description
Add conditional trigger to codex workflow job
Prevent workflow execution without proper labels
Filter for specific codex-related labels only
Diagram Walkthrough
File Walkthrough
codex.yml
Add conditional execution to codex job.github/workflows/codex.yml
ifstatement to codex jobSummary by CodeRabbit