Skip to content

Conversation

bolinfest
Copy link
Collaborator

@bolinfest bolinfest commented May 30, 2025

This is a first cut at a GitHub Action that lets you define prompt templates in .md files under .github/codex/labels that will run Codex with the associated prompt when the label is added to a GitHub pull request.

For example, this PR includes these files:

.github/codex/labels/codex-attempt.md
.github/codex/labels/codex-review.md
.github/codex/labels/codex-triage.md

And the new .github/workflows/codex.yml workflow declares the following triggers:

on:
  issues:
    types: [opened, labeled]
  pull_request:
    branches: [main]
    types: [labeled]

as well as the following expression to gate the action:

jobs:
  codex:
    if: |
      (github.event_name == 'issues' && (
        (github.event.action == 'labeled' && (github.event.label.name == 'codex-attempt' || github.event.label.name == 'codex-investigate-issue'))
      )) ||
      (github.event_name == 'pull_request' && github.event.action == 'labeled' && github.event.label.name == 'codex-code-review')

Note the "actor" who added the label must have write access to the repo for the action to take effect.

After adding a label, the action will "ack" the request by replacing the original label (e.g., codex-review) with an -in-progress suffix (e.g., codex-review-in-progress). When it is finished, it will swap the -in-progress label with a -completed one (e.g., codex-review-completed).

Users of the action are responsible for providing an OPENAI_API_KEY and making it available as a secret to the action.

@bolinfest bolinfest force-pushed the pr1170 branch 3 times, most recently from 54869c1 to 78f116e Compare May 30, 2025 17:43
@bolinfest bolinfest merged commit baa92f3 into main May 30, 2025
18 checks passed
@bolinfest bolinfest deleted the pr1170 branch May 30, 2025 17:55
@github-actions github-actions bot locked and limited conversation to collaborators May 30, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant