— How one GitHub Action turns an Issue label into a pull request you can merge in minutes
Have you ever opened an issue, added a hint of what you wanted changed, and wished the code magically updated itself? That’s exactly what codex‑autopilot does.
https://gist.github.com/bradenkeith/e25914ba3150d7bb575f7ccc7eb24767
What the workflow does
-
Listens for the
codex
label
Tag any issue withcodex
and the workflow wakes up. -
Acknowledges the issue (👀)
It immediately reacts with an eyes emoji so the reporter knows work has started. -
Checks out your repo & installs OpenAI Codex
The workflow pulls the code, installs the Codex CLI, and passes the issue’s title + body as the prompt. -
Codex edits your code—completely non‑interactive
Usingauto-edit
mode, Codex rewrites files or creates new ones in seconds. -
Commits to a new branch (
codex/<issue#>
), pushes, and opens a PR
The branch is deleted automatically after you merge. -
Leaves a tidy, human‑readable commit & PR body
You see exactly which issue it fixes and a link back to the automation.
One prerequisite that can trip you up
Settings → Actions → Workflow permissions → Allow GitHub Actions to create and approve pull requests
If that checkbox is off, the default GITHUB_TOKEN
can’t open PRs and you’ll get
“GitHub Actions is not permitted to create or approve pull requests.”
- Can’t enable it? Swap
secrets.GITHUB_TOKEN
for a PAT withcontents
+pull‑requests
write scopes.
Local dry‑runs with act
brew install act # or use Homebrew/core
act -s GITHUB_TOKEN=$PAT # run the job in Docker exactly as GH would
Supply a Personal Access Token (PAT
) so the create-pull-request
step can push back to GitHub.
Why this matters
- Instant feedback loop – non‑developers can open issues, add the
codex
label, and watch a PR appear. - Reliable automation – Codex runs in a fresh container every time, so you get reproducible edits.
- Human oversight – you still review the PR; Codex never commits directly to
main
.
Ready to try it?
- Copy the YAML from the gist into
.github/workflows/codex‑autopilot.yml
. - Tick the pull‑request permission box (or add a PAT).
- Create an issue, describe your change, add the
codex
label, and enjoy the magic.
See the full code and inline comments here:
https://gist.github.com/bradenkeith/e25914ba3150d7bb575f7ccc7eb24767
Happy auto‑hacking!