Latest commit

History

47 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

ci-workflows

Shared, reusable GitHub Actions workflows for Lennar engineering teams.

The repo is public, so any repo in any org can call these workflows directly — no cross-org setup. The review logic lives here and is maintained once; consuming repos add a tiny caller and nothing else. No secrets are stored here.


codex-pr-review — AI code review on every PR

Automated, codebase-aware code review powered by OpenAI Codex. It behaves like GitHub Copilot's reviewer — inline diff comments plus a summary — with a few deliberate improvements:

  • Zero config. Add one ~20-line caller. No prompt, no stack hints, no install script. The workflow auto-detects your stack (npm/yarn/pnpm, uv/pip, go) and installs deps.
  • Codebase-aware. A single stack-agnostic prompt (bundled here) detects the language and reads your repo's own AGENTS.md / CLAUDE.md / .agents/rules/ for conventions.
  • Never blocks. The review is always posted as a non-blocking COMMENT. The model's verdict is shown as advisory text (Verdict: Changes suggested, 2 issues, 1 suggestion), so resolving threads is clean and nothing wedges your merge.
  • Low noise. It reviews only what changed since its last pass, debounces a burst of pushes into one review, opens inline threads only for findings at or above a severity floor (nitpicks go in the body by default), caps inline threads per run, and pauses on draft or a codex:pause label. See "Reducing thread churn" below.
  • Consistent comments.Conventional Comments (issue / suggestion / nitpick), each with a one-line subject, a required why, and a concrete fix. No emoji.
  • Maintained centrally. Change the review behavior for every repo by editing the prompt here, not by touching each consumer.

Quick start (2 steps)

1. Add the auth secret

Add CODEX_ACCESS_TOKEN at the org level (one-time, shared by all repos) under Settings → Secrets and variables → Actions. Use a static credential: an OpenAI API key (sk-*), an agent-identity JWT, or a personal access token (at-*).

Prefer CODEX_ACCESS_TOKEN for CI. It has no rotating refresh token, so concurrent PR reviews across repos cannot race it. CODEX_AUTH_JSON (a full ~/.codex/auth.json) is a fallback only: its single-use refresh token breaks under concurrent CI runs with "refresh token already used" / 401.

2. Add the caller workflow

Create .github/workflows/pr-review.yml — this is the entire integration, identical in every repo:

name: PR Reviewon:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]permissions:
contents: readpull-requests: writeissues: write# The reusable workflow manages its own per-PR concurrency and debounce, so a# caller-level concurrency block is optional. This one cancels superseded caller# runs early to save minutes on a burst of pushes.concurrency:
group: codex-pr-review-${{ github.event.pull_request.number }}cancel-in-progress: truejobs:
codex-review:
# Same-repo guard: never runs for fork PRs, keeping credentials away from# untrusted code. (Don't add workflow_dispatch to a `pull_request` caller:# an arbitrary PR number would bypass this guard. See "Fork PRs" below.)if: >- github.event.pull_request.head.repo.full_name == github.repository && github.event.pull_request.draft == falseuses: modsy/ci-workflows/.github/workflows/codex-pr-review.yml@v1.0.0with:
pr_number: ${{ github.event.pull_request.number }}secrets:
CODEX_AUTH_JSON: ${{ secrets.CODEX_AUTH_JSON }}

That's it. Open a PR and the reviewer comments within a minute or two. Do not add a prompt — it's bundled here and applied to every caller.


How it works

  1. Your caller triggers on pull_request and calls this reusable workflow.
  2. The workflow:
    • Checks out the PR merge commit (persist-credentials: false, so the token can't push or fetch).
    • Fetches PR metadata and any linked issues for context. Codex runs the git diff itself against the checkout; the diff is not pasted into the prompt.
    • Decides whether to review. Skips if this exact HEAD was already reviewed, if the PR is a draft, or if it carries codex:pause. Otherwise it debounces: it pauses briefly and exits if a newer commit has landed, so a burst of pushes collapses to one review. When a prior review exists, it reviews only the increment since that commit.
    • Auto-installs dependencies by detecting a root manifest: package-lock.jsonnpm ci (and builds workspaces if it's a monorepo), yarn.lock / pnpm-lock.yaml, uv.lockuv sync, requirements.txt / pyproject.toml → pip, go.modgo mod download. Best-effort and continue-on-error: if it can't install, the review still runs statically.
    • Loads the review prompt from this repo (version-locked to the workflow's own commit), never from the PR under review.
    • Runs the Codex CLI in an ephemeral sandbox and parses its JSON output.
    • Posts a single non-blocking COMMENT review. Findings at or above the severity floor open inline threads (capped per run and deduped against prior bot comments); lower-severity, overflow, non-diff, and docs/test-only findings are listed in the body.

Inputs

InputRequiredDefaultDescription
pr_numberNoautoPR to review. Resolved from the triggering event; the caller above passes it explicitly.
codex_versionNo0.142.0Pinned @openai/codex version.
pre_install_commandNo""Optional override for dependency setup. Leave empty for auto-detect. Set only for non-standard layouts (e.g. a package nested in a monorepo subdir).
inline_min_severityNosuggestionMinimum severity that opens an inline thread (blocking/suggestion/nitpick). Findings below the floor go under "Minor notes" in the body. The default keeps nitpicks out of threads.
max_inline_commentsNo10Cap on inline threads per run. Highest-severity findings stay inline; the rest are listed in the body.
debounce_secondsNo30Pause at job start, then re-resolve the PR head. If a newer commit landed, the run exits so a burst of pushes collapses to one review. Set 0 to disable.

Reducing thread churn. The reviewer skips while a PR is a draft or carries the codex:pause label, and resumes when the PR is marked ready or the label is removed. Docs/test-only increments post as summary notes with no inline threads. These behaviors are advisory and never block merge.

Secrets

Provide one (org-level recommended):

SecretWhen to use
CODEX_ACCESS_TOKENPreferred. A static credential: OpenAI API key (sk-*), agent-identity JWT, or personal access token (at-*). No rotating refresh token, so concurrent CI runs cannot race it.
CODEX_AUTH_JSONFallback only. Full ~/.codex/auth.json; its single-use refresh token breaks under concurrent CI runs ("refresh token already used" / 401).

Outputs

OutputDescription
review_urlURL of the posted PR review.

Customizing reviews

There is one prompt for all repos: .github/codex/prompts/codex-pr-review.md.

  • Change it for everyone: edit the prompt here and open a PR.
  • Tune it for one repo: document the convention in that repo's AGENTS.md / CLAUDE.md — the prompt reads them at review time.

You should never need a prompt file in a consuming repo.


Security model

ConcernHow it's addressed
Secret isolationAuth secrets are stored per org/repo and passed at call time. Never stored here.
Prompt integrityThe prompt is read from this repo at the workflow's own commit, never from the PR — a PR can't change what the credentialed reviewer runs.
Fork exfiltrationThe caller's same-repo if: guard prevents the workflow (and its secrets) from running on fork PRs. See "Fork PRs" below for the pull_request_target case.
Credential leak via gitpersist-credentials: false keeps GITHUB_TOKEN out of git config.
Script injectionGitHub context values reach the shell only as environment variables, never interpolated into run: blocks.
SandboxCodex runs --ephemeral --sandbox workspace-write: no persistent state, writes scoped to the workspace.

Fork PRs

Whether workflow_dispatch is safe on a caller depends entirely on its trigger. There is no single rule, so pick the row that matches your repo.

Your repoTriggerworkflow_dispatchExample
Never receives fork PRspull_requestOptional. There is no fork guard to bypass, so it only skips the draft check.pr-review-internal.yml
Receives fork PRs, don't review thempull_request + same-repo if:No. Dispatch runs in base context with secrets against an operator-supplied pr_number, which is precisely the bypass the guard exists to prevent.the quick-start caller above
Receives fork PRs, want them reviewedpull_request_target + same-repo if:Yes, and it is the only way in. Read the caveat below first.pr-review-with-fork-guard.yml

Most repos are row 2. Reach for pull_request_target only if you genuinely need fork PRs reviewed, and understand what you are accepting.

The pull_request_target caveat. That trigger runs in the base-branch context and has repo secrets, which is why fork review is possible at all. The same-repo if: blocks automatic runs on forks; workflow_dispatch is the deliberate hatch so a maintainer can review a fork PR by hand. But the reviewer still checks out refs/pull/N/merge, which is the fork's code. The only thing standing between a malicious fork and your secrets is a maintainer having actually read the diff before dispatching. That is a real control, and a human one. Do not treat it as equivalent to the same-repo guard.


Versioning

Pin callers to an immutable patch tag:

uses: modsy/ci-workflows/.github/workflows/codex-pr-review.yml@v1.0.0

These workflows run with the caller's secrets and pull-requests: write. An immutable tag is the only ref where adopting a new reviewer version requires a change in the consuming repo, which is the point of pinning. A commit SHA works identically.

Do not use @main: every merge here would reach every consumer immediately.

A moving v1 alias exists and is repointed at each release. It is a convenience for consumers who accept automatic adoption, not the recommended ref: because a tag can be re-pointed, @v1 still lets a new version land in a credentialed job with no PR in the consuming repo.

Cutting a release

git tag -a v1.x.y -m "<summary>"&& git push origin v1.x.y
git tag -f v1 v1.x.y && git push -f origin v1

Then bump the pinned tag in each consumer via PR. Consumers on @v1 pick it up with no action, and no review.

Troubleshooting

SymptomCause / fix
Review never appearsConfirm CODEX_AUTH_JSON (or CODEX_ACCESS_TOKEN) is set and visible to the repo. The codex-review job's auth step fails fast without it.
Either CODEX_ACCESS_TOKEN or CODEX_AUTH_JSON secret is requiredNo auth secret reached the workflow. Add it at the org or repo level.
refresh token already used / intermittent 401You are on the CODEX_AUTH_JSON fallback; its single-use refresh token is being raced by concurrent CI runs. Switch to a static CODEX_ACCESS_TOKEN.
401 from api.openai.com/v1/responsesAn sk-* key lacks api.responses.write, or is out of credits. Use an agent-identity JWT / at-* token as CODEX_ACCESS_TOKEN.
invalid agent identity JWT formatCODEX_ACCESS_TOKEN isn't a valid JWT/PAT. Re-mint the token.
Review is shallow / misses conventionsAdd an AGENTS.md or CLAUDE.md to your repo; the prompt reads them for project rules.
Dependencies not installedAuto-detect is best-effort. For a nested monorepo package, set pre_install_command to your install command.
Fork PRs not reviewedIntentional — the same-repo guard keeps secrets away from fork code.

secret-scan: block secrets and flag PII on every PR

A CI-side gate that stops hardcoded secrets (API keys, tokens, private keys, connection strings) from merging, and optionally flags likely PII/PHI for human review. It complements, and does not replace, pre-commit hooks: a pre-commit hook is skipped by --no-verify, IDE commits, and web/API pushes, so this workflow catches everything that actually reaches the PR.

  • Zero config, stack-agnostic. One small caller. gitleaks runs from a directly-downloaded binary (no marketplace action, no license key that org accounts otherwise need).
  • Diff-scoped by default. Scans only the commits the PR introduces, so a pre-existing finding on the base branch does not fail your PR. Set scan_scope: full for a one-time history audit.
  • Blocks by default, deliberately. Unlike the advisory code reviewer, a detected secret fails the check (fail_on_secrets: true). Set it false for report-only mode. Values are redacted in logs and the PR comment.
  • Advisory PII sweep (opt-in).scan_pii: true adds a high-confidence email/SSN/phone regex pass over added lines. It NEVER blocks the merge, regex PII detection is false-positive-prone. True PHI coverage needs a dedicated service and is out of scope for a dependency-free gate.
  • One comment, upserted. Results post to a single marker-tagged PR comment that updates in place, so pushes do not pile up duplicates.

Caller

name: Secret Scanon:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]permissions:
contents: readpull-requests: writejobs:
secret-scan:
if: github.event.pull_request.draft == falseuses: modsy/ci-workflows/.github/workflows/secret-scan.yml@v1.0.0with:
scan_scope: "diff"# or "full"fail_on_secrets: true # false for report-only# scan_pii: true # advisory email/SSN/phone sweep# gitleaks_config: ".gitleaks.toml" # repo-specific rules / allowlist

No secret needs to be configured. See examples/secret-scan.yml and examples/secret-scan-with-fork-guard.yml.

Inputs

InputDefaultPurpose
scan_scope"diff"diff scans the PR's commits; full scans all history on the head.
fail_on_secretstrueFail (block) on a secret finding, or report-only when false.
scan_piifalseEnable the advisory PII sweep. Never blocks regardless of fail_on_secrets.
gitleaks_config""Path to a custom .gitleaks.toml for repo-specific rules or allowlists.
gitleaks_versionpinnedgitleaks release to install. Bump deliberately.

Custom rules and false positives

Point gitleaks_config at a .gitleaks.toml in your repo to add rules (e.g. Django SECRET_KEY, VITE_-prefixed vars, an internal token format) or to allowlist known test fixtures. Inline gitleaks:allow comments and a .gitleaksignore file also suppress specific findings.


Contributing

Maintained by the modsy platform team. Open a PR for changes that benefit consuming teams, and call out any breaking input or behavior change in the description.

About

Shared reusable CI workflows for Lennar engineering teams

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all
 blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks");
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Skip to content

Latest commit

History

47 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

ci-workflows

Shared, reusable GitHub Actions workflows for Lennar engineering teams.

The repo is public, so any repo in any org can call these workflows directly — no cross-org setup. The review logic lives here and is maintained once; consuming repos add a tiny caller and nothing else. No secrets are stored here.


codex-pr-review — AI code review on every PR

Automated, codebase-aware code review powered by OpenAI Codex. It behaves like GitHub Copilot's reviewer — inline diff comments plus a summary — with a few deliberate improvements:

  • Zero config. Add one ~20-line caller. No prompt, no stack hints, no install script. The workflow auto-detects your stack (npm/yarn/pnpm, uv/pip, go) and installs deps.
  • Codebase-aware. A single stack-agnostic prompt (bundled here) detects the language and reads your repo's own AGENTS.md / CLAUDE.md / .agents/rules/ for conventions.
  • Never blocks. The review is always posted as a non-blocking COMMENT. The model's verdict is shown as advisory text (Verdict: Changes suggested, 2 issues, 1 suggestion), so resolving threads is clean and nothing wedges your merge.
  • Low noise. It reviews only what changed since its last pass, debounces a burst of pushes into one review, opens inline threads only for findings at or above a severity floor (nitpicks go in the body by default), caps inline threads per run, and pauses on draft or a codex:pause label. See "Reducing thread churn" below.
  • Consistent comments.Conventional Comments (issue / suggestion / nitpick), each with a one-line subject, a required why, and a concrete fix. No emoji.
  • Maintained centrally. Change the review behavior for every repo by editing the prompt here, not by touching each consumer.

Quick start (2 steps)

1. Add the auth secret

Add CODEX_ACCESS_TOKEN at the org level (one-time, shared by all repos) under Settings → Secrets and variables → Actions. Use a static credential: an OpenAI API key (sk-*), an agent-identity JWT, or a personal access token (at-*).

Prefer CODEX_ACCESS_TOKEN for CI. It has no rotating refresh token, so concurrent PR reviews across repos cannot race it. CODEX_AUTH_JSON (a full ~/.codex/auth.json) is a fallback only: its single-use refresh token breaks under concurrent CI runs with "refresh token already used" / 401.

2. Add the caller workflow

Create .github/workflows/pr-review.yml — this is the entire integration, identical in every repo:

name: PR Reviewon:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]permissions:
contents: readpull-requests: writeissues: write# The reusable workflow manages its own per-PR concurrency and debounce, so a# caller-level concurrency block is optional. This one cancels superseded caller# runs early to save minutes on a burst of pushes.concurrency:
group: codex-pr-review-${{ github.event.pull_request.number }}cancel-in-progress: truejobs:
codex-review:
# Same-repo guard: never runs for fork PRs, keeping credentials away from# untrusted code. (Don't add workflow_dispatch to a `pull_request` caller:# an arbitrary PR number would bypass this guard. See "Fork PRs" below.)if: >- github.event.pull_request.head.repo.full_name == github.repository && github.event.pull_request.draft == falseuses: modsy/ci-workflows/.github/workflows/codex-pr-review.yml@v1.0.0with:
pr_number: ${{ github.event.pull_request.number }}secrets:
CODEX_AUTH_JSON: ${{ secrets.CODEX_AUTH_JSON }}

That's it. Open a PR and the reviewer comments within a minute or two. Do not add a prompt — it's bundled here and applied to every caller.


How it works

  1. Your caller triggers on pull_request and calls this reusable workflow.
  2. The workflow:
    • Checks out the PR merge commit (persist-credentials: false, so the token can't push or fetch).
    • Fetches PR metadata and any linked issues for context. Codex runs the git diff itself against the checkout; the diff is not pasted into the prompt.
    • Decides whether to review. Skips if this exact HEAD was already reviewed, if the PR is a draft, or if it carries codex:pause. Otherwise it debounces: it pauses briefly and exits if a newer commit has landed, so a burst of pushes collapses to one review. When a prior review exists, it reviews only the increment since that commit.
    • Auto-installs dependencies by detecting a root manifest: package-lock.jsonnpm ci (and builds workspaces if it's a monorepo), yarn.lock / pnpm-lock.yaml, uv.lockuv sync, requirements.txt / pyproject.toml → pip, go.modgo mod download. Best-effort and continue-on-error: if it can't install, the review still runs statically.
    • Loads the review prompt from this repo (version-locked to the workflow's own commit), never from the PR under review.
    • Runs the Codex CLI in an ephemeral sandbox and parses its JSON output.
    • Posts a single non-blocking COMMENT review. Findings at or above the severity floor open inline threads (capped per run and deduped against prior bot comments); lower-severity, overflow, non-diff, and docs/test-only findings are listed in the body.

Inputs

InputRequiredDefaultDescription
pr_numberNoautoPR to review. Resolved from the triggering event; the caller above passes it explicitly.
codex_versionNo0.142.0Pinned @openai/codex version.
pre_install_commandNo""Optional override for dependency setup. Leave empty for auto-detect. Set only for non-standard layouts (e.g. a package nested in a monorepo subdir).
inline_min_severityNosuggestionMinimum severity that opens an inline thread (blocking/suggestion/nitpick). Findings below the floor go under "Minor notes" in the body. The default keeps nitpicks out of threads.
max_inline_commentsNo10Cap on inline threads per run. Highest-severity findings stay inline; the rest are listed in the body.
debounce_secondsNo30Pause at job start, then re-resolve the PR head. If a newer commit landed, the run exits so a burst of pushes collapses to one review. Set 0 to disable.

Reducing thread churn. The reviewer skips while a PR is a draft or carries the codex:pause label, and resumes when the PR is marked ready or the label is removed. Docs/test-only increments post as summary notes with no inline threads. These behaviors are advisory and never block merge.

Secrets

Provide one (org-level recommended):

SecretWhen to use
CODEX_ACCESS_TOKENPreferred. A static credential: OpenAI API key (sk-*), agent-identity JWT, or personal access token (at-*). No rotating refresh token, so concurrent CI runs cannot race it.
CODEX_AUTH_JSONFallback only. Full ~/.codex/auth.json; its single-use refresh token breaks under concurrent CI runs ("refresh token already used" / 401).

Outputs

OutputDescription
review_urlURL of the posted PR review.

Customizing reviews

There is one prompt for all repos: .github/codex/prompts/codex-pr-review.md.

  • Change it for everyone: edit the prompt here and open a PR.
  • Tune it for one repo: document the convention in that repo's AGENTS.md / CLAUDE.md — the prompt reads them at review time.

You should never need a prompt file in a consuming repo.


Security model

ConcernHow it's addressed
Secret isolationAuth secrets are stored per org/repo and passed at call time. Never stored here.
Prompt integrityThe prompt is read from this repo at the workflow's own commit, never from the PR — a PR can't change what the credentialed reviewer runs.
Fork exfiltrationThe caller's same-repo if: guard prevents the workflow (and its secrets) from running on fork PRs. See "Fork PRs" below for the pull_request_target case.
Credential leak via gitpersist-credentials: false keeps GITHUB_TOKEN out of git config.
Script injectionGitHub context values reach the shell only as environment variables, never interpolated into run: blocks.
SandboxCodex runs --ephemeral --sandbox workspace-write: no persistent state, writes scoped to the workspace.

Fork PRs

Whether workflow_dispatch is safe on a caller depends entirely on its trigger. There is no single rule, so pick the row that matches your repo.

Your repoTriggerworkflow_dispatchExample
Never receives fork PRspull_requestOptional. There is no fork guard to bypass, so it only skips the draft check.pr-review-internal.yml
Receives fork PRs, don't review thempull_request + same-repo if:No. Dispatch runs in base context with secrets against an operator-supplied pr_number, which is precisely the bypass the guard exists to prevent.the quick-start caller above
Receives fork PRs, want them reviewedpull_request_target + same-repo if:Yes, and it is the only way in. Read the caveat below first.pr-review-with-fork-guard.yml

Most repos are row 2. Reach for pull_request_target only if you genuinely need fork PRs reviewed, and understand what you are accepting.

The pull_request_target caveat. That trigger runs in the base-branch context and has repo secrets, which is why fork review is possible at all. The same-repo if: blocks automatic runs on forks; workflow_dispatch is the deliberate hatch so a maintainer can review a fork PR by hand. But the reviewer still checks out refs/pull/N/merge, which is the fork's code. The only thing standing between a malicious fork and your secrets is a maintainer having actually read the diff before dispatching. That is a real control, and a human one. Do not treat it as equivalent to the same-repo guard.


Versioning

Pin callers to an immutable patch tag:

uses: modsy/ci-workflows/.github/workflows/codex-pr-review.yml@v1.0.0

These workflows run with the caller's secrets and pull-requests: write. An immutable tag is the only ref where adopting a new reviewer version requires a change in the consuming repo, which is the point of pinning. A commit SHA works identically.

Do not use @main: every merge here would reach every consumer immediately.

A moving v1 alias exists and is repointed at each release. It is a convenience for consumers who accept automatic adoption, not the recommended ref: because a tag can be re-pointed, @v1 still lets a new version land in a credentialed job with no PR in the consuming repo.

Cutting a release

git tag -a v1.x.y -m "<summary>"&& git push origin v1.x.y
git tag -f v1 v1.x.y && git push -f origin v1

Then bump the pinned tag in each consumer via PR. Consumers on @v1 pick it up with no action, and no review.

Troubleshooting

SymptomCause / fix
Review never appearsConfirm CODEX_AUTH_JSON (or CODEX_ACCESS_TOKEN) is set and visible to the repo. The codex-review job's auth step fails fast without it.
Either CODEX_ACCESS_TOKEN or CODEX_AUTH_JSON secret is requiredNo auth secret reached the workflow. Add it at the org or repo level.
refresh token already used / intermittent 401You are on the CODEX_AUTH_JSON fallback; its single-use refresh token is being raced by concurrent CI runs. Switch to a static CODEX_ACCESS_TOKEN.
401 from api.openai.com/v1/responsesAn sk-* key lacks api.responses.write, or is out of credits. Use an agent-identity JWT / at-* token as CODEX_ACCESS_TOKEN.
invalid agent identity JWT formatCODEX_ACCESS_TOKEN isn't a valid JWT/PAT. Re-mint the token.
Review is shallow / misses conventionsAdd an AGENTS.md or CLAUDE.md to your repo; the prompt reads them for project rules.
Dependencies not installedAuto-detect is best-effort. For a nested monorepo package, set pre_install_command to your install command.
Fork PRs not reviewedIntentional — the same-repo guard keeps secrets away from fork code.

secret-scan: block secrets and flag PII on every PR

A CI-side gate that stops hardcoded secrets (API keys, tokens, private keys, connection strings) from merging, and optionally flags likely PII/PHI for human review. It complements, and does not replace, pre-commit hooks: a pre-commit hook is skipped by --no-verify, IDE commits, and web/API pushes, so this workflow catches everything that actually reaches the PR.

  • Zero config, stack-agnostic. One small caller. gitleaks runs from a directly-downloaded binary (no marketplace action, no license key that org accounts otherwise need).
  • Diff-scoped by default. Scans only the commits the PR introduces, so a pre-existing finding on the base branch does not fail your PR. Set scan_scope: full for a one-time history audit.
  • Blocks by default, deliberately. Unlike the advisory code reviewer, a detected secret fails the check (fail_on_secrets: true). Set it false for report-only mode. Values are redacted in logs and the PR comment.
  • Advisory PII sweep (opt-in).scan_pii: true adds a high-confidence email/SSN/phone regex pass over added lines. It NEVER blocks the merge, regex PII detection is false-positive-prone. True PHI coverage needs a dedicated service and is out of scope for a dependency-free gate.
  • One comment, upserted. Results post to a single marker-tagged PR comment that updates in place, so pushes do not pile up duplicates.

Caller

name: Secret Scanon:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]permissions:
contents: readpull-requests: writejobs:
secret-scan:
if: github.event.pull_request.draft == falseuses: modsy/ci-workflows/.github/workflows/secret-scan.yml@v1.0.0with:
scan_scope: "diff"# or "full"fail_on_secrets: true # false for report-only# scan_pii: true # advisory email/SSN/phone sweep# gitleaks_config: ".gitleaks.toml" # repo-specific rules / allowlist

No secret needs to be configured. See examples/secret-scan.yml and examples/secret-scan-with-fork-guard.yml.

Inputs

InputDefaultPurpose
scan_scope"diff"diff scans the PR's commits; full scans all history on the head.
fail_on_secretstrueFail (block) on a secret finding, or report-only when false.
scan_piifalseEnable the advisory PII sweep. Never blocks regardless of fail_on_secrets.
gitleaks_config""Path to a custom .gitleaks.toml for repo-specific rules or allowlists.
gitleaks_versionpinnedgitleaks release to install. Bump deliberately.

Custom rules and false positives

Point gitleaks_config at a .gitleaks.toml in your repo to add rules (e.g. Django SECRET_KEY, VITE_-prefixed vars, an internal token format) or to allowlist known test fixtures. Inline gitleaks:allow comments and a .gitleaksignore file also suppress specific findings.


Contributing

Maintained by the modsy platform team. Open a PR for changes that benefit consuming teams, and call out any breaking input or behavior change in the description.

About

Shared reusable CI workflows for Lennar engineering teams

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Force GitHub README to respect dark mode\n(function() {\n var style = document.createElement('style');\n style.textContent = '\n .markdown-body {\n color-scheme: dark light;\n }\n .markdown-body pre { background: #161b22 !important; }\n .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; }\n .markdown-body table th, .markdown-body table td { border-color: #30363d !important; }\n .markdown-body img { background: #0d1117; }\n .markdown-body blockquote { border-left-color: #8b949e; }\n .markdown-body hr { border-color: #30363d; }\n ';\n document.head.appendChild(style);\n})();", "GitHub Dark Mode README Fix"); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Latest commit

History

47 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

ci-workflows

Shared, reusable GitHub Actions workflows for Lennar engineering teams.

The repo is public, so any repo in any org can call these workflows directly — no cross-org setup. The review logic lives here and is maintained once; consuming repos add a tiny caller and nothing else. No secrets are stored here.


codex-pr-review — AI code review on every PR

Automated, codebase-aware code review powered by OpenAI Codex. It behaves like GitHub Copilot's reviewer — inline diff comments plus a summary — with a few deliberate improvements:

  • Zero config. Add one ~20-line caller. No prompt, no stack hints, no install script. The workflow auto-detects your stack (npm/yarn/pnpm, uv/pip, go) and installs deps.
  • Codebase-aware. A single stack-agnostic prompt (bundled here) detects the language and reads your repo's own AGENTS.md / CLAUDE.md / .agents/rules/ for conventions.
  • Never blocks. The review is always posted as a non-blocking COMMENT. The model's verdict is shown as advisory text (Verdict: Changes suggested, 2 issues, 1 suggestion), so resolving threads is clean and nothing wedges your merge.
  • Low noise. It reviews only what changed since its last pass, debounces a burst of pushes into one review, opens inline threads only for findings at or above a severity floor (nitpicks go in the body by default), caps inline threads per run, and pauses on draft or a codex:pause label. See "Reducing thread churn" below.
  • Consistent comments.Conventional Comments (issue / suggestion / nitpick), each with a one-line subject, a required why, and a concrete fix. No emoji.
  • Maintained centrally. Change the review behavior for every repo by editing the prompt here, not by touching each consumer.

Quick start (2 steps)

1. Add the auth secret

Add CODEX_ACCESS_TOKEN at the org level (one-time, shared by all repos) under Settings → Secrets and variables → Actions. Use a static credential: an OpenAI API key (sk-*), an agent-identity JWT, or a personal access token (at-*).

Prefer CODEX_ACCESS_TOKEN for CI. It has no rotating refresh token, so concurrent PR reviews across repos cannot race it. CODEX_AUTH_JSON (a full ~/.codex/auth.json) is a fallback only: its single-use refresh token breaks under concurrent CI runs with "refresh token already used" / 401.

2. Add the caller workflow

Create .github/workflows/pr-review.yml — this is the entire integration, identical in every repo:

name: PR Reviewon:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]permissions:
contents: readpull-requests: writeissues: write# The reusable workflow manages its own per-PR concurrency and debounce, so a# caller-level concurrency block is optional. This one cancels superseded caller# runs early to save minutes on a burst of pushes.concurrency:
group: codex-pr-review-${{ github.event.pull_request.number }}cancel-in-progress: truejobs:
codex-review:
# Same-repo guard: never runs for fork PRs, keeping credentials away from# untrusted code. (Don't add workflow_dispatch to a `pull_request` caller:# an arbitrary PR number would bypass this guard. See "Fork PRs" below.)if: >- github.event.pull_request.head.repo.full_name == github.repository && github.event.pull_request.draft == falseuses: modsy/ci-workflows/.github/workflows/codex-pr-review.yml@v1.0.0with:
pr_number: ${{ github.event.pull_request.number }}secrets:
CODEX_AUTH_JSON: ${{ secrets.CODEX_AUTH_JSON }}

That's it. Open a PR and the reviewer comments within a minute or two. Do not add a prompt — it's bundled here and applied to every caller.


How it works

  1. Your caller triggers on pull_request and calls this reusable workflow.
  2. The workflow:
    • Checks out the PR merge commit (persist-credentials: false, so the token can't push or fetch).
    • Fetches PR metadata and any linked issues for context. Codex runs the git diff itself against the checkout; the diff is not pasted into the prompt.
    • Decides whether to review. Skips if this exact HEAD was already reviewed, if the PR is a draft, or if it carries codex:pause. Otherwise it debounces: it pauses briefly and exits if a newer commit has landed, so a burst of pushes collapses to one review. When a prior review exists, it reviews only the increment since that commit.
    • Auto-installs dependencies by detecting a root manifest: package-lock.jsonnpm ci (and builds workspaces if it's a monorepo), yarn.lock / pnpm-lock.yaml, uv.lockuv sync, requirements.txt / pyproject.toml → pip, go.modgo mod download. Best-effort and continue-on-error: if it can't install, the review still runs statically.
    • Loads the review prompt from this repo (version-locked to the workflow's own commit), never from the PR under review.
    • Runs the Codex CLI in an ephemeral sandbox and parses its JSON output.
    • Posts a single non-blocking COMMENT review. Findings at or above the severity floor open inline threads (capped per run and deduped against prior bot comments); lower-severity, overflow, non-diff, and docs/test-only findings are listed in the body.

Inputs

InputRequiredDefaultDescription
pr_numberNoautoPR to review. Resolved from the triggering event; the caller above passes it explicitly.
codex_versionNo0.142.0Pinned @openai/codex version.
pre_install_commandNo""Optional override for dependency setup. Leave empty for auto-detect. Set only for non-standard layouts (e.g. a package nested in a monorepo subdir).
inline_min_severityNosuggestionMinimum severity that opens an inline thread (blocking/suggestion/nitpick). Findings below the floor go under "Minor notes" in the body. The default keeps nitpicks out of threads.
max_inline_commentsNo10Cap on inline threads per run. Highest-severity findings stay inline; the rest are listed in the body.
debounce_secondsNo30Pause at job start, then re-resolve the PR head. If a newer commit landed, the run exits so a burst of pushes collapses to one review. Set 0 to disable.

Reducing thread churn. The reviewer skips while a PR is a draft or carries the codex:pause label, and resumes when the PR is marked ready or the label is removed. Docs/test-only increments post as summary notes with no inline threads. These behaviors are advisory and never block merge.

Secrets

Provide one (org-level recommended):

SecretWhen to use
CODEX_ACCESS_TOKENPreferred. A static credential: OpenAI API key (sk-*), agent-identity JWT, or personal access token (at-*). No rotating refresh token, so concurrent CI runs cannot race it.
CODEX_AUTH_JSONFallback only. Full ~/.codex/auth.json; its single-use refresh token breaks under concurrent CI runs ("refresh token already used" / 401).

Outputs

OutputDescription
review_urlURL of the posted PR review.

Customizing reviews

There is one prompt for all repos: .github/codex/prompts/codex-pr-review.md.

  • Change it for everyone: edit the prompt here and open a PR.
  • Tune it for one repo: document the convention in that repo's AGENTS.md / CLAUDE.md — the prompt reads them at review time.

You should never need a prompt file in a consuming repo.


Security model

ConcernHow it's addressed
Secret isolationAuth secrets are stored per org/repo and passed at call time. Never stored here.
Prompt integrityThe prompt is read from this repo at the workflow's own commit, never from the PR — a PR can't change what the credentialed reviewer runs.
Fork exfiltrationThe caller's same-repo if: guard prevents the workflow (and its secrets) from running on fork PRs. See "Fork PRs" below for the pull_request_target case.
Credential leak via gitpersist-credentials: false keeps GITHUB_TOKEN out of git config.
Script injectionGitHub context values reach the shell only as environment variables, never interpolated into run: blocks.
SandboxCodex runs --ephemeral --sandbox workspace-write: no persistent state, writes scoped to the workspace.

Fork PRs

Whether workflow_dispatch is safe on a caller depends entirely on its trigger. There is no single rule, so pick the row that matches your repo.

Your repoTriggerworkflow_dispatchExample
Never receives fork PRspull_requestOptional. There is no fork guard to bypass, so it only skips the draft check.pr-review-internal.yml
Receives fork PRs, don't review thempull_request + same-repo if:No. Dispatch runs in base context with secrets against an operator-supplied pr_number, which is precisely the bypass the guard exists to prevent.the quick-start caller above
Receives fork PRs, want them reviewedpull_request_target + same-repo if:Yes, and it is the only way in. Read the caveat below first.pr-review-with-fork-guard.yml

Most repos are row 2. Reach for pull_request_target only if you genuinely need fork PRs reviewed, and understand what you are accepting.

The pull_request_target caveat. That trigger runs in the base-branch context and has repo secrets, which is why fork review is possible at all. The same-repo if: blocks automatic runs on forks; workflow_dispatch is the deliberate hatch so a maintainer can review a fork PR by hand. But the reviewer still checks out refs/pull/N/merge, which is the fork's code. The only thing standing between a malicious fork and your secrets is a maintainer having actually read the diff before dispatching. That is a real control, and a human one. Do not treat it as equivalent to the same-repo guard.


Versioning

Pin callers to an immutable patch tag:

uses: modsy/ci-workflows/.github/workflows/codex-pr-review.yml@v1.0.0

These workflows run with the caller's secrets and pull-requests: write. An immutable tag is the only ref where adopting a new reviewer version requires a change in the consuming repo, which is the point of pinning. A commit SHA works identically.

Do not use @main: every merge here would reach every consumer immediately.

A moving v1 alias exists and is repointed at each release. It is a convenience for consumers who accept automatic adoption, not the recommended ref: because a tag can be re-pointed, @v1 still lets a new version land in a credentialed job with no PR in the consuming repo.

Cutting a release

git tag -a v1.x.y -m "<summary>"&& git push origin v1.x.y
git tag -f v1 v1.x.y && git push -f origin v1

Then bump the pinned tag in each consumer via PR. Consumers on @v1 pick it up with no action, and no review.

Troubleshooting

SymptomCause / fix
Review never appearsConfirm CODEX_AUTH_JSON (or CODEX_ACCESS_TOKEN) is set and visible to the repo. The codex-review job's auth step fails fast without it.
Either CODEX_ACCESS_TOKEN or CODEX_AUTH_JSON secret is requiredNo auth secret reached the workflow. Add it at the org or repo level.
refresh token already used / intermittent 401You are on the CODEX_AUTH_JSON fallback; its single-use refresh token is being raced by concurrent CI runs. Switch to a static CODEX_ACCESS_TOKEN.
401 from api.openai.com/v1/responsesAn sk-* key lacks api.responses.write, or is out of credits. Use an agent-identity JWT / at-* token as CODEX_ACCESS_TOKEN.
invalid agent identity JWT formatCODEX_ACCESS_TOKEN isn't a valid JWT/PAT. Re-mint the token.
Review is shallow / misses conventionsAdd an AGENTS.md or CLAUDE.md to your repo; the prompt reads them for project rules.
Dependencies not installedAuto-detect is best-effort. For a nested monorepo package, set pre_install_command to your install command.
Fork PRs not reviewedIntentional — the same-repo guard keeps secrets away from fork code.

secret-scan: block secrets and flag PII on every PR

A CI-side gate that stops hardcoded secrets (API keys, tokens, private keys, connection strings) from merging, and optionally flags likely PII/PHI for human review. It complements, and does not replace, pre-commit hooks: a pre-commit hook is skipped by --no-verify, IDE commits, and web/API pushes, so this workflow catches everything that actually reaches the PR.

  • Zero config, stack-agnostic. One small caller. gitleaks runs from a directly-downloaded binary (no marketplace action, no license key that org accounts otherwise need).
  • Diff-scoped by default. Scans only the commits the PR introduces, so a pre-existing finding on the base branch does not fail your PR. Set scan_scope: full for a one-time history audit.
  • Blocks by default, deliberately. Unlike the advisory code reviewer, a detected secret fails the check (fail_on_secrets: true). Set it false for report-only mode. Values are redacted in logs and the PR comment.
  • Advisory PII sweep (opt-in).scan_pii: true adds a high-confidence email/SSN/phone regex pass over added lines. It NEVER blocks the merge, regex PII detection is false-positive-prone. True PHI coverage needs a dedicated service and is out of scope for a dependency-free gate.
  • One comment, upserted. Results post to a single marker-tagged PR comment that updates in place, so pushes do not pile up duplicates.

Caller

name: Secret Scanon:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]permissions:
contents: readpull-requests: writejobs:
secret-scan:
if: github.event.pull_request.draft == falseuses: modsy/ci-workflows/.github/workflows/secret-scan.yml@v1.0.0with:
scan_scope: "diff"# or "full"fail_on_secrets: true # false for report-only# scan_pii: true # advisory email/SSN/phone sweep# gitleaks_config: ".gitleaks.toml" # repo-specific rules / allowlist

No secret needs to be configured. See examples/secret-scan.yml and examples/secret-scan-with-fork-guard.yml.

Inputs

InputDefaultPurpose
scan_scope"diff"diff scans the PR's commits; full scans all history on the head.
fail_on_secretstrueFail (block) on a secret finding, or report-only when false.
scan_piifalseEnable the advisory PII sweep. Never blocks regardless of fail_on_secrets.
gitleaks_config""Path to a custom .gitleaks.toml for repo-specific rules or allowlists.
gitleaks_versionpinnedgitleaks release to install. Bump deliberately.

Custom rules and false positives

Point gitleaks_config at a .gitleaks.toml in your repo to add rules (e.g. Django SECRET_KEY, VITE_-prefixed vars, an internal token format) or to allowlist known test fixtures. Inline gitleaks:allow comments and a .gitleaksignore file also suppress specific findings.


Contributing

Maintained by the modsy platform team. Open a PR for changes that benefit consuming teams, and call out any breaking input or behavior change in the description.

About

Shared reusable CI workflows for Lennar engineering teams

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Highlight search terms from Google/DuckDuckGo/Bing referrer\n(function() {\n var ref = document.referrer;\n var terms = [];\n \n if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) {\n var url = new URL(ref);\n var q = url.searchParams.get('q') || url.searchParams.get('p');\n if (q) {\n terms = q.split(/\\s+/).filter(function(t) { return t.length > 2; });\n }\n }\n \n if (terms.length === 0) return;\n \n var style = document.createElement('style');\n style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }';\n document.head.appendChild(style);\n \n function highlight(node) {\n if (node.nodeType === 3) { // text node\n var text = node.textContent;\n var found = false;\n terms.forEach(function(term) {\n var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\') + ')', 'gi');\n if (regex.test(text)) {\n found = true;\n var frag = document.createDocumentFragment();\n var parts = text.split(regex);\n parts.forEach(function(part, i) {\n if (i % 2 === 0) {\n frag.appendChild(document.createTextNode(part));\n } else {\n var span = document.createElement('span');\n span.className = 'userscript-highlight';\n span.textContent = part;\n frag.appendChild(span);\n }\n });\n node.parentNode.replaceChild(frag, node);\n }\n });\n } else if (node.nodeType === 1 && node.childNodes) { // element\n var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];\n if (!skipTags.includes(node.tagName)) {\n Array.from(node.childNodes).forEach(highlight);\n }\n }\n }\n \n highlight(document.body);\n \n // Re-highlight on dynamic content\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1 || node.nodeType === 3) highlight(node);\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Highlight Search Terms"); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Latest commit

History

47 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

ci-workflows

Shared, reusable GitHub Actions workflows for Lennar engineering teams.

The repo is public, so any repo in any org can call these workflows directly — no cross-org setup. The review logic lives here and is maintained once; consuming repos add a tiny caller and nothing else. No secrets are stored here.


codex-pr-review — AI code review on every PR

Automated, codebase-aware code review powered by OpenAI Codex. It behaves like GitHub Copilot's reviewer — inline diff comments plus a summary — with a few deliberate improvements:

  • Zero config. Add one ~20-line caller. No prompt, no stack hints, no install script. The workflow auto-detects your stack (npm/yarn/pnpm, uv/pip, go) and installs deps.
  • Codebase-aware. A single stack-agnostic prompt (bundled here) detects the language and reads your repo's own AGENTS.md / CLAUDE.md / .agents/rules/ for conventions.
  • Never blocks. The review is always posted as a non-blocking COMMENT. The model's verdict is shown as advisory text (Verdict: Changes suggested, 2 issues, 1 suggestion), so resolving threads is clean and nothing wedges your merge.
  • Low noise. It reviews only what changed since its last pass, debounces a burst of pushes into one review, opens inline threads only for findings at or above a severity floor (nitpicks go in the body by default), caps inline threads per run, and pauses on draft or a codex:pause label. See "Reducing thread churn" below.
  • Consistent comments.Conventional Comments (issue / suggestion / nitpick), each with a one-line subject, a required why, and a concrete fix. No emoji.
  • Maintained centrally. Change the review behavior for every repo by editing the prompt here, not by touching each consumer.

Quick start (2 steps)

1. Add the auth secret

Add CODEX_ACCESS_TOKEN at the org level (one-time, shared by all repos) under Settings → Secrets and variables → Actions. Use a static credential: an OpenAI API key (sk-*), an agent-identity JWT, or a personal access token (at-*).

Prefer CODEX_ACCESS_TOKEN for CI. It has no rotating refresh token, so concurrent PR reviews across repos cannot race it. CODEX_AUTH_JSON (a full ~/.codex/auth.json) is a fallback only: its single-use refresh token breaks under concurrent CI runs with "refresh token already used" / 401.

2. Add the caller workflow

Create .github/workflows/pr-review.yml — this is the entire integration, identical in every repo:

name: PR Reviewon:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]permissions:
contents: readpull-requests: writeissues: write# The reusable workflow manages its own per-PR concurrency and debounce, so a# caller-level concurrency block is optional. This one cancels superseded caller# runs early to save minutes on a burst of pushes.concurrency:
group: codex-pr-review-${{ github.event.pull_request.number }}cancel-in-progress: truejobs:
codex-review:
# Same-repo guard: never runs for fork PRs, keeping credentials away from# untrusted code. (Don't add workflow_dispatch to a `pull_request` caller:# an arbitrary PR number would bypass this guard. See "Fork PRs" below.)if: >- github.event.pull_request.head.repo.full_name == github.repository && github.event.pull_request.draft == falseuses: modsy/ci-workflows/.github/workflows/codex-pr-review.yml@v1.0.0with:
pr_number: ${{ github.event.pull_request.number }}secrets:
CODEX_AUTH_JSON: ${{ secrets.CODEX_AUTH_JSON }}

That's it. Open a PR and the reviewer comments within a minute or two. Do not add a prompt — it's bundled here and applied to every caller.


How it works

  1. Your caller triggers on pull_request and calls this reusable workflow.
  2. The workflow:
    • Checks out the PR merge commit (persist-credentials: false, so the token can't push or fetch).
    • Fetches PR metadata and any linked issues for context. Codex runs the git diff itself against the checkout; the diff is not pasted into the prompt.
    • Decides whether to review. Skips if this exact HEAD was already reviewed, if the PR is a draft, or if it carries codex:pause. Otherwise it debounces: it pauses briefly and exits if a newer commit has landed, so a burst of pushes collapses to one review. When a prior review exists, it reviews only the increment since that commit.
    • Auto-installs dependencies by detecting a root manifest: package-lock.jsonnpm ci (and builds workspaces if it's a monorepo), yarn.lock / pnpm-lock.yaml, uv.lockuv sync, requirements.txt / pyproject.toml → pip, go.modgo mod download. Best-effort and continue-on-error: if it can't install, the review still runs statically.
    • Loads the review prompt from this repo (version-locked to the workflow's own commit), never from the PR under review.
    • Runs the Codex CLI in an ephemeral sandbox and parses its JSON output.
    • Posts a single non-blocking COMMENT review. Findings at or above the severity floor open inline threads (capped per run and deduped against prior bot comments); lower-severity, overflow, non-diff, and docs/test-only findings are listed in the body.

Inputs

InputRequiredDefaultDescription
pr_numberNoautoPR to review. Resolved from the triggering event; the caller above passes it explicitly.
codex_versionNo0.142.0Pinned @openai/codex version.
pre_install_commandNo""Optional override for dependency setup. Leave empty for auto-detect. Set only for non-standard layouts (e.g. a package nested in a monorepo subdir).
inline_min_severityNosuggestionMinimum severity that opens an inline thread (blocking/suggestion/nitpick). Findings below the floor go under "Minor notes" in the body. The default keeps nitpicks out of threads.
max_inline_commentsNo10Cap on inline threads per run. Highest-severity findings stay inline; the rest are listed in the body.
debounce_secondsNo30Pause at job start, then re-resolve the PR head. If a newer commit landed, the run exits so a burst of pushes collapses to one review. Set 0 to disable.

Reducing thread churn. The reviewer skips while a PR is a draft or carries the codex:pause label, and resumes when the PR is marked ready or the label is removed. Docs/test-only increments post as summary notes with no inline threads. These behaviors are advisory and never block merge.

Secrets

Provide one (org-level recommended):

SecretWhen to use
CODEX_ACCESS_TOKENPreferred. A static credential: OpenAI API key (sk-*), agent-identity JWT, or personal access token (at-*). No rotating refresh token, so concurrent CI runs cannot race it.
CODEX_AUTH_JSONFallback only. Full ~/.codex/auth.json; its single-use refresh token breaks under concurrent CI runs ("refresh token already used" / 401).

Outputs

OutputDescription
review_urlURL of the posted PR review.

Customizing reviews

There is one prompt for all repos: .github/codex/prompts/codex-pr-review.md.

  • Change it for everyone: edit the prompt here and open a PR.
  • Tune it for one repo: document the convention in that repo's AGENTS.md / CLAUDE.md — the prompt reads them at review time.

You should never need a prompt file in a consuming repo.


Security model

ConcernHow it's addressed
Secret isolationAuth secrets are stored per org/repo and passed at call time. Never stored here.
Prompt integrityThe prompt is read from this repo at the workflow's own commit, never from the PR — a PR can't change what the credentialed reviewer runs.
Fork exfiltrationThe caller's same-repo if: guard prevents the workflow (and its secrets) from running on fork PRs. See "Fork PRs" below for the pull_request_target case.
Credential leak via gitpersist-credentials: false keeps GITHUB_TOKEN out of git config.
Script injectionGitHub context values reach the shell only as environment variables, never interpolated into run: blocks.
SandboxCodex runs --ephemeral --sandbox workspace-write: no persistent state, writes scoped to the workspace.

Fork PRs

Whether workflow_dispatch is safe on a caller depends entirely on its trigger. There is no single rule, so pick the row that matches your repo.

Your repoTriggerworkflow_dispatchExample
Never receives fork PRspull_requestOptional. There is no fork guard to bypass, so it only skips the draft check.pr-review-internal.yml
Receives fork PRs, don't review thempull_request + same-repo if:No. Dispatch runs in base context with secrets against an operator-supplied pr_number, which is precisely the bypass the guard exists to prevent.the quick-start caller above
Receives fork PRs, want them reviewedpull_request_target + same-repo if:Yes, and it is the only way in. Read the caveat below first.pr-review-with-fork-guard.yml

Most repos are row 2. Reach for pull_request_target only if you genuinely need fork PRs reviewed, and understand what you are accepting.

The pull_request_target caveat. That trigger runs in the base-branch context and has repo secrets, which is why fork review is possible at all. The same-repo if: blocks automatic runs on forks; workflow_dispatch is the deliberate hatch so a maintainer can review a fork PR by hand. But the reviewer still checks out refs/pull/N/merge, which is the fork's code. The only thing standing between a malicious fork and your secrets is a maintainer having actually read the diff before dispatching. That is a real control, and a human one. Do not treat it as equivalent to the same-repo guard.


Versioning

Pin callers to an immutable patch tag:

uses: modsy/ci-workflows/.github/workflows/codex-pr-review.yml@v1.0.0

These workflows run with the caller's secrets and pull-requests: write. An immutable tag is the only ref where adopting a new reviewer version requires a change in the consuming repo, which is the point of pinning. A commit SHA works identically.

Do not use @main: every merge here would reach every consumer immediately.

A moving v1 alias exists and is repointed at each release. It is a convenience for consumers who accept automatic adoption, not the recommended ref: because a tag can be re-pointed, @v1 still lets a new version land in a credentialed job with no PR in the consuming repo.

Cutting a release

git tag -a v1.x.y -m "<summary>"&& git push origin v1.x.y
git tag -f v1 v1.x.y && git push -f origin v1

Then bump the pinned tag in each consumer via PR. Consumers on @v1 pick it up with no action, and no review.

Troubleshooting

SymptomCause / fix
Review never appearsConfirm CODEX_AUTH_JSON (or CODEX_ACCESS_TOKEN) is set and visible to the repo. The codex-review job's auth step fails fast without it.
Either CODEX_ACCESS_TOKEN or CODEX_AUTH_JSON secret is requiredNo auth secret reached the workflow. Add it at the org or repo level.
refresh token already used / intermittent 401You are on the CODEX_AUTH_JSON fallback; its single-use refresh token is being raced by concurrent CI runs. Switch to a static CODEX_ACCESS_TOKEN.
401 from api.openai.com/v1/responsesAn sk-* key lacks api.responses.write, or is out of credits. Use an agent-identity JWT / at-* token as CODEX_ACCESS_TOKEN.
invalid agent identity JWT formatCODEX_ACCESS_TOKEN isn't a valid JWT/PAT. Re-mint the token.
Review is shallow / misses conventionsAdd an AGENTS.md or CLAUDE.md to your repo; the prompt reads them for project rules.
Dependencies not installedAuto-detect is best-effort. For a nested monorepo package, set pre_install_command to your install command.
Fork PRs not reviewedIntentional — the same-repo guard keeps secrets away from fork code.

secret-scan: block secrets and flag PII on every PR

A CI-side gate that stops hardcoded secrets (API keys, tokens, private keys, connection strings) from merging, and optionally flags likely PII/PHI for human review. It complements, and does not replace, pre-commit hooks: a pre-commit hook is skipped by --no-verify, IDE commits, and web/API pushes, so this workflow catches everything that actually reaches the PR.

  • Zero config, stack-agnostic. One small caller. gitleaks runs from a directly-downloaded binary (no marketplace action, no license key that org accounts otherwise need).
  • Diff-scoped by default. Scans only the commits the PR introduces, so a pre-existing finding on the base branch does not fail your PR. Set scan_scope: full for a one-time history audit.
  • Blocks by default, deliberately. Unlike the advisory code reviewer, a detected secret fails the check (fail_on_secrets: true). Set it false for report-only mode. Values are redacted in logs and the PR comment.
  • Advisory PII sweep (opt-in).scan_pii: true adds a high-confidence email/SSN/phone regex pass over added lines. It NEVER blocks the merge, regex PII detection is false-positive-prone. True PHI coverage needs a dedicated service and is out of scope for a dependency-free gate.
  • One comment, upserted. Results post to a single marker-tagged PR comment that updates in place, so pushes do not pile up duplicates.

Caller

name: Secret Scanon:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]permissions:
contents: readpull-requests: writejobs:
secret-scan:
if: github.event.pull_request.draft == falseuses: modsy/ci-workflows/.github/workflows/secret-scan.yml@v1.0.0with:
scan_scope: "diff"# or "full"fail_on_secrets: true # false for report-only# scan_pii: true # advisory email/SSN/phone sweep# gitleaks_config: ".gitleaks.toml" # repo-specific rules / allowlist

No secret needs to be configured. See examples/secret-scan.yml and examples/secret-scan-with-fork-guard.yml.

Inputs

InputDefaultPurpose
scan_scope"diff"diff scans the PR's commits; full scans all history on the head.
fail_on_secretstrueFail (block) on a secret finding, or report-only when false.
scan_piifalseEnable the advisory PII sweep. Never blocks regardless of fail_on_secrets.
gitleaks_config""Path to a custom .gitleaks.toml for repo-specific rules or allowlists.
gitleaks_versionpinnedgitleaks release to install. Bump deliberately.

Custom rules and false positives

Point gitleaks_config at a .gitleaks.toml in your repo to add rules (e.g. Django SECRET_KEY, VITE_-prefixed vars, an internal token format) or to allowlist known test fixtures. Inline gitleaks:allow comments and a .gitleaksignore file also suppress specific findings.


Contributing

Maintained by the modsy platform team. Open a PR for changes that benefit consuming teams, and call out any breaking input or behavior change in the description.

About

Shared reusable CI workflows for Lennar engineering teams

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Strip utm_, fbclid, gclid, etc. from all links on page\n(function() {\n var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',\n 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',\n 'ref', 'ref_src', 'source', 'medium', 'campaign'];\n \n function cleanUrl(url) {\n try {\n var u = new URL(url, window.location.origin);\n var changed = false;\n trackingParams.forEach(function(p) {\n if (u.searchParams.has(p)) {\n u.searchParams.delete(p);\n changed = true;\n }\n });\n return changed ? u.toString() : url;\n } catch (e) {\n return url;\n }\n }\n \n function cleanLinks() {\n document.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n \n cleanLinks();\n \n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1) {\n if (node.tagName === 'A') cleanLinks();\n node.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Remove Tracking Parameters from Links"); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content

Latest commit

History

47 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

ci-workflows

Shared, reusable GitHub Actions workflows for Lennar engineering teams.

The repo is public, so any repo in any org can call these workflows directly — no cross-org setup. The review logic lives here and is maintained once; consuming repos add a tiny caller and nothing else. No secrets are stored here.


codex-pr-review — AI code review on every PR

Automated, codebase-aware code review powered by OpenAI Codex. It behaves like GitHub Copilot's reviewer — inline diff comments plus a summary — with a few deliberate improvements:

  • Zero config. Add one ~20-line caller. No prompt, no stack hints, no install script. The workflow auto-detects your stack (npm/yarn/pnpm, uv/pip, go) and installs deps.
  • Codebase-aware. A single stack-agnostic prompt (bundled here) detects the language and reads your repo's own AGENTS.md / CLAUDE.md / .agents/rules/ for conventions.
  • Never blocks. The review is always posted as a non-blocking COMMENT. The model's verdict is shown as advisory text (Verdict: Changes suggested, 2 issues, 1 suggestion), so resolving threads is clean and nothing wedges your merge.
  • Low noise. It reviews only what changed since its last pass, debounces a burst of pushes into one review, opens inline threads only for findings at or above a severity floor (nitpicks go in the body by default), caps inline threads per run, and pauses on draft or a codex:pause label. See "Reducing thread churn" below.
  • Consistent comments.Conventional Comments (issue / suggestion / nitpick), each with a one-line subject, a required why, and a concrete fix. No emoji.
  • Maintained centrally. Change the review behavior for every repo by editing the prompt here, not by touching each consumer.

Quick start (2 steps)

1. Add the auth secret

Add CODEX_ACCESS_TOKEN at the org level (one-time, shared by all repos) under Settings → Secrets and variables → Actions. Use a static credential: an OpenAI API key (sk-*), an agent-identity JWT, or a personal access token (at-*).

Prefer CODEX_ACCESS_TOKEN for CI. It has no rotating refresh token, so concurrent PR reviews across repos cannot race it. CODEX_AUTH_JSON (a full ~/.codex/auth.json) is a fallback only: its single-use refresh token breaks under concurrent CI runs with "refresh token already used" / 401.

2. Add the caller workflow

Create .github/workflows/pr-review.yml — this is the entire integration, identical in every repo:

name: PR Reviewon:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]permissions:
contents: readpull-requests: writeissues: write# The reusable workflow manages its own per-PR concurrency and debounce, so a# caller-level concurrency block is optional. This one cancels superseded caller# runs early to save minutes on a burst of pushes.concurrency:
group: codex-pr-review-${{ github.event.pull_request.number }}cancel-in-progress: truejobs:
codex-review:
# Same-repo guard: never runs for fork PRs, keeping credentials away from# untrusted code. (Don't add workflow_dispatch to a `pull_request` caller:# an arbitrary PR number would bypass this guard. See "Fork PRs" below.)if: >- github.event.pull_request.head.repo.full_name == github.repository && github.event.pull_request.draft == falseuses: modsy/ci-workflows/.github/workflows/codex-pr-review.yml@v1.0.0with:
pr_number: ${{ github.event.pull_request.number }}secrets:
CODEX_AUTH_JSON: ${{ secrets.CODEX_AUTH_JSON }}

That's it. Open a PR and the reviewer comments within a minute or two. Do not add a prompt — it's bundled here and applied to every caller.


How it works

  1. Your caller triggers on pull_request and calls this reusable workflow.
  2. The workflow:
    • Checks out the PR merge commit (persist-credentials: false, so the token can't push or fetch).
    • Fetches PR metadata and any linked issues for context. Codex runs the git diff itself against the checkout; the diff is not pasted into the prompt.
    • Decides whether to review. Skips if this exact HEAD was already reviewed, if the PR is a draft, or if it carries codex:pause. Otherwise it debounces: it pauses briefly and exits if a newer commit has landed, so a burst of pushes collapses to one review. When a prior review exists, it reviews only the increment since that commit.
    • Auto-installs dependencies by detecting a root manifest: package-lock.jsonnpm ci (and builds workspaces if it's a monorepo), yarn.lock / pnpm-lock.yaml, uv.lockuv sync, requirements.txt / pyproject.toml → pip, go.modgo mod download. Best-effort and continue-on-error: if it can't install, the review still runs statically.
    • Loads the review prompt from this repo (version-locked to the workflow's own commit), never from the PR under review.
    • Runs the Codex CLI in an ephemeral sandbox and parses its JSON output.
    • Posts a single non-blocking COMMENT review. Findings at or above the severity floor open inline threads (capped per run and deduped against prior bot comments); lower-severity, overflow, non-diff, and docs/test-only findings are listed in the body.

Inputs

InputRequiredDefaultDescription
pr_numberNoautoPR to review. Resolved from the triggering event; the caller above passes it explicitly.
codex_versionNo0.142.0Pinned @openai/codex version.
pre_install_commandNo""Optional override for dependency setup. Leave empty for auto-detect. Set only for non-standard layouts (e.g. a package nested in a monorepo subdir).
inline_min_severityNosuggestionMinimum severity that opens an inline thread (blocking/suggestion/nitpick). Findings below the floor go under "Minor notes" in the body. The default keeps nitpicks out of threads.
max_inline_commentsNo10Cap on inline threads per run. Highest-severity findings stay inline; the rest are listed in the body.
debounce_secondsNo30Pause at job start, then re-resolve the PR head. If a newer commit landed, the run exits so a burst of pushes collapses to one review. Set 0 to disable.

Reducing thread churn. The reviewer skips while a PR is a draft or carries the codex:pause label, and resumes when the PR is marked ready or the label is removed. Docs/test-only increments post as summary notes with no inline threads. These behaviors are advisory and never block merge.

Secrets

Provide one (org-level recommended):

SecretWhen to use
CODEX_ACCESS_TOKENPreferred. A static credential: OpenAI API key (sk-*), agent-identity JWT, or personal access token (at-*). No rotating refresh token, so concurrent CI runs cannot race it.
CODEX_AUTH_JSONFallback only. Full ~/.codex/auth.json; its single-use refresh token breaks under concurrent CI runs ("refresh token already used" / 401).

Outputs

OutputDescription
review_urlURL of the posted PR review.

Customizing reviews

There is one prompt for all repos: .github/codex/prompts/codex-pr-review.md.

  • Change it for everyone: edit the prompt here and open a PR.
  • Tune it for one repo: document the convention in that repo's AGENTS.md / CLAUDE.md — the prompt reads them at review time.

You should never need a prompt file in a consuming repo.


Security model

ConcernHow it's addressed
Secret isolationAuth secrets are stored per org/repo and passed at call time. Never stored here.
Prompt integrityThe prompt is read from this repo at the workflow's own commit, never from the PR — a PR can't change what the credentialed reviewer runs.
Fork exfiltrationThe caller's same-repo if: guard prevents the workflow (and its secrets) from running on fork PRs. See "Fork PRs" below for the pull_request_target case.
Credential leak via gitpersist-credentials: false keeps GITHUB_TOKEN out of git config.
Script injectionGitHub context values reach the shell only as environment variables, never interpolated into run: blocks.
SandboxCodex runs --ephemeral --sandbox workspace-write: no persistent state, writes scoped to the workspace.

Fork PRs

Whether workflow_dispatch is safe on a caller depends entirely on its trigger. There is no single rule, so pick the row that matches your repo.

Your repoTriggerworkflow_dispatchExample
Never receives fork PRspull_requestOptional. There is no fork guard to bypass, so it only skips the draft check.pr-review-internal.yml
Receives fork PRs, don't review thempull_request + same-repo if:No. Dispatch runs in base context with secrets against an operator-supplied pr_number, which is precisely the bypass the guard exists to prevent.the quick-start caller above
Receives fork PRs, want them reviewedpull_request_target + same-repo if:Yes, and it is the only way in. Read the caveat below first.pr-review-with-fork-guard.yml

Most repos are row 2. Reach for pull_request_target only if you genuinely need fork PRs reviewed, and understand what you are accepting.

The pull_request_target caveat. That trigger runs in the base-branch context and has repo secrets, which is why fork review is possible at all. The same-repo if: blocks automatic runs on forks; workflow_dispatch is the deliberate hatch so a maintainer can review a fork PR by hand. But the reviewer still checks out refs/pull/N/merge, which is the fork's code. The only thing standing between a malicious fork and your secrets is a maintainer having actually read the diff before dispatching. That is a real control, and a human one. Do not treat it as equivalent to the same-repo guard.


Versioning

Pin callers to an immutable patch tag:

uses: modsy/ci-workflows/.github/workflows/codex-pr-review.yml@v1.0.0

These workflows run with the caller's secrets and pull-requests: write. An immutable tag is the only ref where adopting a new reviewer version requires a change in the consuming repo, which is the point of pinning. A commit SHA works identically.

Do not use @main: every merge here would reach every consumer immediately.

A moving v1 alias exists and is repointed at each release. It is a convenience for consumers who accept automatic adoption, not the recommended ref: because a tag can be re-pointed, @v1 still lets a new version land in a credentialed job with no PR in the consuming repo.

Cutting a release

git tag -a v1.x.y -m "<summary>"&& git push origin v1.x.y
git tag -f v1 v1.x.y && git push -f origin v1

Then bump the pinned tag in each consumer via PR. Consumers on @v1 pick it up with no action, and no review.

Troubleshooting

SymptomCause / fix
Review never appearsConfirm CODEX_AUTH_JSON (or CODEX_ACCESS_TOKEN) is set and visible to the repo. The codex-review job's auth step fails fast without it.
Either CODEX_ACCESS_TOKEN or CODEX_AUTH_JSON secret is requiredNo auth secret reached the workflow. Add it at the org or repo level.
refresh token already used / intermittent 401You are on the CODEX_AUTH_JSON fallback; its single-use refresh token is being raced by concurrent CI runs. Switch to a static CODEX_ACCESS_TOKEN.
401 from api.openai.com/v1/responsesAn sk-* key lacks api.responses.write, or is out of credits. Use an agent-identity JWT / at-* token as CODEX_ACCESS_TOKEN.
invalid agent identity JWT formatCODEX_ACCESS_TOKEN isn't a valid JWT/PAT. Re-mint the token.
Review is shallow / misses conventionsAdd an AGENTS.md or CLAUDE.md to your repo; the prompt reads them for project rules.
Dependencies not installedAuto-detect is best-effort. For a nested monorepo package, set pre_install_command to your install command.
Fork PRs not reviewedIntentional — the same-repo guard keeps secrets away from fork code.

secret-scan: block secrets and flag PII on every PR

A CI-side gate that stops hardcoded secrets (API keys, tokens, private keys, connection strings) from merging, and optionally flags likely PII/PHI for human review. It complements, and does not replace, pre-commit hooks: a pre-commit hook is skipped by --no-verify, IDE commits, and web/API pushes, so this workflow catches everything that actually reaches the PR.

  • Zero config, stack-agnostic. One small caller. gitleaks runs from a directly-downloaded binary (no marketplace action, no license key that org accounts otherwise need).
  • Diff-scoped by default. Scans only the commits the PR introduces, so a pre-existing finding on the base branch does not fail your PR. Set scan_scope: full for a one-time history audit.
  • Blocks by default, deliberately. Unlike the advisory code reviewer, a detected secret fails the check (fail_on_secrets: true). Set it false for report-only mode. Values are redacted in logs and the PR comment.
  • Advisory PII sweep (opt-in).scan_pii: true adds a high-confidence email/SSN/phone regex pass over added lines. It NEVER blocks the merge, regex PII detection is false-positive-prone. True PHI coverage needs a dedicated service and is out of scope for a dependency-free gate.
  • One comment, upserted. Results post to a single marker-tagged PR comment that updates in place, so pushes do not pile up duplicates.

Caller

name: Secret Scanon:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]permissions:
contents: readpull-requests: writejobs:
secret-scan:
if: github.event.pull_request.draft == falseuses: modsy/ci-workflows/.github/workflows/secret-scan.yml@v1.0.0with:
scan_scope: "diff"# or "full"fail_on_secrets: true # false for report-only# scan_pii: true # advisory email/SSN/phone sweep# gitleaks_config: ".gitleaks.toml" # repo-specific rules / allowlist

No secret needs to be configured. See examples/secret-scan.yml and examples/secret-scan-with-fork-guard.yml.

Inputs

InputDefaultPurpose
scan_scope"diff"diff scans the PR's commits; full scans all history on the head.
fail_on_secretstrueFail (block) on a secret finding, or report-only when false.
scan_piifalseEnable the advisory PII sweep. Never blocks regardless of fail_on_secrets.
gitleaks_config""Path to a custom .gitleaks.toml for repo-specific rules or allowlists.
gitleaks_versionpinnedgitleaks release to install. Bump deliberately.

Custom rules and false positives

Point gitleaks_config at a .gitleaks.toml in your repo to add rules (e.g. Django SECRET_KEY, VITE_-prefixed vars, an internal token format) or to allowlist known test fixtures. Inline gitleaks:allow comments and a .gitleaksignore file also suppress specific findings.


Contributing

Maintained by the modsy platform team. Open a PR for changes that benefit consuming teams, and call out any breaking input or behavior change in the description.

About

Shared reusable CI workflows for Lennar engineering teams

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Latest commit

History

47 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

ci-workflows

Shared, reusable GitHub Actions workflows for Lennar engineering teams.

The repo is public, so any repo in any org can call these workflows directly — no cross-org setup. The review logic lives here and is maintained once; consuming repos add a tiny caller and nothing else. No secrets are stored here.


codex-pr-review — AI code review on every PR

Automated, codebase-aware code review powered by OpenAI Codex. It behaves like GitHub Copilot's reviewer — inline diff comments plus a summary — with a few deliberate improvements:

  • Zero config. Add one ~20-line caller. No prompt, no stack hints, no install script. The workflow auto-detects your stack (npm/yarn/pnpm, uv/pip, go) and installs deps.
  • Codebase-aware. A single stack-agnostic prompt (bundled here) detects the language and reads your repo's own AGENTS.md / CLAUDE.md / .agents/rules/ for conventions.
  • Never blocks. The review is always posted as a non-blocking COMMENT. The model's verdict is shown as advisory text (Verdict: Changes suggested, 2 issues, 1 suggestion), so resolving threads is clean and nothing wedges your merge.
  • Low noise. It reviews only what changed since its last pass, debounces a burst of pushes into one review, opens inline threads only for findings at or above a severity floor (nitpicks go in the body by default), caps inline threads per run, and pauses on draft or a codex:pause label. See "Reducing thread churn" below.
  • Consistent comments.Conventional Comments (issue / suggestion / nitpick), each with a one-line subject, a required why, and a concrete fix. No emoji.
  • Maintained centrally. Change the review behavior for every repo by editing the prompt here, not by touching each consumer.

Quick start (2 steps)

1. Add the auth secret

Add CODEX_ACCESS_TOKEN at the org level (one-time, shared by all repos) under Settings → Secrets and variables → Actions. Use a static credential: an OpenAI API key (sk-*), an agent-identity JWT, or a personal access token (at-*).

Prefer CODEX_ACCESS_TOKEN for CI. It has no rotating refresh token, so concurrent PR reviews across repos cannot race it. CODEX_AUTH_JSON (a full ~/.codex/auth.json) is a fallback only: its single-use refresh token breaks under concurrent CI runs with "refresh token already used" / 401.

2. Add the caller workflow

Create .github/workflows/pr-review.yml — this is the entire integration, identical in every repo:

name: PR Reviewon:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]permissions:
contents: readpull-requests: writeissues: write# The reusable workflow manages its own per-PR concurrency and debounce, so a# caller-level concurrency block is optional. This one cancels superseded caller# runs early to save minutes on a burst of pushes.concurrency:
group: codex-pr-review-${{ github.event.pull_request.number }}cancel-in-progress: truejobs:
codex-review:
# Same-repo guard: never runs for fork PRs, keeping credentials away from# untrusted code. (Don't add workflow_dispatch to a `pull_request` caller:# an arbitrary PR number would bypass this guard. See "Fork PRs" below.)if: >- github.event.pull_request.head.repo.full_name == github.repository && github.event.pull_request.draft == falseuses: modsy/ci-workflows/.github/workflows/codex-pr-review.yml@v1.0.0with:
pr_number: ${{ github.event.pull_request.number }}secrets:
CODEX_AUTH_JSON: ${{ secrets.CODEX_AUTH_JSON }}

That's it. Open a PR and the reviewer comments within a minute or two. Do not add a prompt — it's bundled here and applied to every caller.


How it works

  1. Your caller triggers on pull_request and calls this reusable workflow.
  2. The workflow:
    • Checks out the PR merge commit (persist-credentials: false, so the token can't push or fetch).
    • Fetches PR metadata and any linked issues for context. Codex runs the git diff itself against the checkout; the diff is not pasted into the prompt.
    • Decides whether to review. Skips if this exact HEAD was already reviewed, if the PR is a draft, or if it carries codex:pause. Otherwise it debounces: it pauses briefly and exits if a newer commit has landed, so a burst of pushes collapses to one review. When a prior review exists, it reviews only the increment since that commit.
    • Auto-installs dependencies by detecting a root manifest: package-lock.jsonnpm ci (and builds workspaces if it's a monorepo), yarn.lock / pnpm-lock.yaml, uv.lockuv sync, requirements.txt / pyproject.toml → pip, go.modgo mod download. Best-effort and continue-on-error: if it can't install, the review still runs statically.
    • Loads the review prompt from this repo (version-locked to the workflow's own commit), never from the PR under review.
    • Runs the Codex CLI in an ephemeral sandbox and parses its JSON output.
    • Posts a single non-blocking COMMENT review. Findings at or above the severity floor open inline threads (capped per run and deduped against prior bot comments); lower-severity, overflow, non-diff, and docs/test-only findings are listed in the body.

Inputs

InputRequiredDefaultDescription
pr_numberNoautoPR to review. Resolved from the triggering event; the caller above passes it explicitly.
codex_versionNo0.142.0Pinned @openai/codex version.
pre_install_commandNo""Optional override for dependency setup. Leave empty for auto-detect. Set only for non-standard layouts (e.g. a package nested in a monorepo subdir).
inline_min_severityNosuggestionMinimum severity that opens an inline thread (blocking/suggestion/nitpick). Findings below the floor go under "Minor notes" in the body. The default keeps nitpicks out of threads.
max_inline_commentsNo10Cap on inline threads per run. Highest-severity findings stay inline; the rest are listed in the body.
debounce_secondsNo30Pause at job start, then re-resolve the PR head. If a newer commit landed, the run exits so a burst of pushes collapses to one review. Set 0 to disable.

Reducing thread churn. The reviewer skips while a PR is a draft or carries the codex:pause label, and resumes when the PR is marked ready or the label is removed. Docs/test-only increments post as summary notes with no inline threads. These behaviors are advisory and never block merge.

Secrets

Provide one (org-level recommended):

SecretWhen to use
CODEX_ACCESS_TOKENPreferred. A static credential: OpenAI API key (sk-*), agent-identity JWT, or personal access token (at-*). No rotating refresh token, so concurrent CI runs cannot race it.
CODEX_AUTH_JSONFallback only. Full ~/.codex/auth.json; its single-use refresh token breaks under concurrent CI runs ("refresh token already used" / 401).

Outputs

OutputDescription
review_urlURL of the posted PR review.

Customizing reviews

There is one prompt for all repos: .github/codex/prompts/codex-pr-review.md.

  • Change it for everyone: edit the prompt here and open a PR.
  • Tune it for one repo: document the convention in that repo's AGENTS.md / CLAUDE.md — the prompt reads them at review time.

You should never need a prompt file in a consuming repo.


Security model

ConcernHow it's addressed
Secret isolationAuth secrets are stored per org/repo and passed at call time. Never stored here.
Prompt integrityThe prompt is read from this repo at the workflow's own commit, never from the PR — a PR can't change what the credentialed reviewer runs.
Fork exfiltrationThe caller's same-repo if: guard prevents the workflow (and its secrets) from running on fork PRs. See "Fork PRs" below for the pull_request_target case.
Credential leak via gitpersist-credentials: false keeps GITHUB_TOKEN out of git config.
Script injectionGitHub context values reach the shell only as environment variables, never interpolated into run: blocks.
SandboxCodex runs --ephemeral --sandbox workspace-write: no persistent state, writes scoped to the workspace.

Fork PRs

Whether workflow_dispatch is safe on a caller depends entirely on its trigger. There is no single rule, so pick the row that matches your repo.

Your repoTriggerworkflow_dispatchExample
Never receives fork PRspull_requestOptional. There is no fork guard to bypass, so it only skips the draft check.pr-review-internal.yml
Receives fork PRs, don't review thempull_request + same-repo if:No. Dispatch runs in base context with secrets against an operator-supplied pr_number, which is precisely the bypass the guard exists to prevent.the quick-start caller above
Receives fork PRs, want them reviewedpull_request_target + same-repo if:Yes, and it is the only way in. Read the caveat below first.pr-review-with-fork-guard.yml

Most repos are row 2. Reach for pull_request_target only if you genuinely need fork PRs reviewed, and understand what you are accepting.

The pull_request_target caveat. That trigger runs in the base-branch context and has repo secrets, which is why fork review is possible at all. The same-repo if: blocks automatic runs on forks; workflow_dispatch is the deliberate hatch so a maintainer can review a fork PR by hand. But the reviewer still checks out refs/pull/N/merge, which is the fork's code. The only thing standing between a malicious fork and your secrets is a maintainer having actually read the diff before dispatching. That is a real control, and a human one. Do not treat it as equivalent to the same-repo guard.


Versioning

Pin callers to an immutable patch tag:

uses: modsy/ci-workflows/.github/workflows/codex-pr-review.yml@v1.0.0

These workflows run with the caller's secrets and pull-requests: write. An immutable tag is the only ref where adopting a new reviewer version requires a change in the consuming repo, which is the point of pinning. A commit SHA works identically.

Do not use @main: every merge here would reach every consumer immediately.

A moving v1 alias exists and is repointed at each release. It is a convenience for consumers who accept automatic adoption, not the recommended ref: because a tag can be re-pointed, @v1 still lets a new version land in a credentialed job with no PR in the consuming repo.

Cutting a release

git tag -a v1.x.y -m "<summary>"&& git push origin v1.x.y
git tag -f v1 v1.x.y && git push -f origin v1

Then bump the pinned tag in each consumer via PR. Consumers on @v1 pick it up with no action, and no review.

Troubleshooting

SymptomCause / fix
Review never appearsConfirm CODEX_AUTH_JSON (or CODEX_ACCESS_TOKEN) is set and visible to the repo. The codex-review job's auth step fails fast without it.
Either CODEX_ACCESS_TOKEN or CODEX_AUTH_JSON secret is requiredNo auth secret reached the workflow. Add it at the org or repo level.
refresh token already used / intermittent 401You are on the CODEX_AUTH_JSON fallback; its single-use refresh token is being raced by concurrent CI runs. Switch to a static CODEX_ACCESS_TOKEN.
401 from api.openai.com/v1/responsesAn sk-* key lacks api.responses.write, or is out of credits. Use an agent-identity JWT / at-* token as CODEX_ACCESS_TOKEN.
invalid agent identity JWT formatCODEX_ACCESS_TOKEN isn't a valid JWT/PAT. Re-mint the token.
Review is shallow / misses conventionsAdd an AGENTS.md or CLAUDE.md to your repo; the prompt reads them for project rules.
Dependencies not installedAuto-detect is best-effort. For a nested monorepo package, set pre_install_command to your install command.
Fork PRs not reviewedIntentional — the same-repo guard keeps secrets away from fork code.

secret-scan: block secrets and flag PII on every PR

A CI-side gate that stops hardcoded secrets (API keys, tokens, private keys, connection strings) from merging, and optionally flags likely PII/PHI for human review. It complements, and does not replace, pre-commit hooks: a pre-commit hook is skipped by --no-verify, IDE commits, and web/API pushes, so this workflow catches everything that actually reaches the PR.

  • Zero config, stack-agnostic. One small caller. gitleaks runs from a directly-downloaded binary (no marketplace action, no license key that org accounts otherwise need).
  • Diff-scoped by default. Scans only the commits the PR introduces, so a pre-existing finding on the base branch does not fail your PR. Set scan_scope: full for a one-time history audit.
  • Blocks by default, deliberately. Unlike the advisory code reviewer, a detected secret fails the check (fail_on_secrets: true). Set it false for report-only mode. Values are redacted in logs and the PR comment.
  • Advisory PII sweep (opt-in).scan_pii: true adds a high-confidence email/SSN/phone regex pass over added lines. It NEVER blocks the merge, regex PII detection is false-positive-prone. True PHI coverage needs a dedicated service and is out of scope for a dependency-free gate.
  • One comment, upserted. Results post to a single marker-tagged PR comment that updates in place, so pushes do not pile up duplicates.

Caller

name: Secret Scanon:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]permissions:
contents: readpull-requests: writejobs:
secret-scan:
if: github.event.pull_request.draft == falseuses: modsy/ci-workflows/.github/workflows/secret-scan.yml@v1.0.0with:
scan_scope: "diff"# or "full"fail_on_secrets: true # false for report-only# scan_pii: true # advisory email/SSN/phone sweep# gitleaks_config: ".gitleaks.toml" # repo-specific rules / allowlist

No secret needs to be configured. See examples/secret-scan.yml and examples/secret-scan-with-fork-guard.yml.

Inputs

InputDefaultPurpose
scan_scope"diff"diff scans the PR's commits; full scans all history on the head.
fail_on_secretstrueFail (block) on a secret finding, or report-only when false.
scan_piifalseEnable the advisory PII sweep. Never blocks regardless of fail_on_secrets.
gitleaks_config""Path to a custom .gitleaks.toml for repo-specific rules or allowlists.
gitleaks_versionpinnedgitleaks release to install. Bump deliberately.

Custom rules and false positives

Point gitleaks_config at a .gitleaks.toml in your repo to add rules (e.g. Django SECRET_KEY, VITE_-prefixed vars, an internal token format) or to allowlist known test fixtures. Inline gitleaks:allow comments and a .gitleaksignore file also suppress specific findings.


Contributing

Maintained by the modsy platform team. Open a PR for changes that benefit consuming teams, and call out any breaking input or behavior change in the description.

About

Shared reusable CI workflows for Lennar engineering teams

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Latest commit

History

47 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

ci-workflows

Shared, reusable GitHub Actions workflows for Lennar engineering teams.

The repo is public, so any repo in any org can call these workflows directly — no cross-org setup. The review logic lives here and is maintained once; consuming repos add a tiny caller and nothing else. No secrets are stored here.


codex-pr-review — AI code review on every PR

Automated, codebase-aware code review powered by OpenAI Codex. It behaves like GitHub Copilot's reviewer — inline diff comments plus a summary — with a few deliberate improvements:

  • Zero config. Add one ~20-line caller. No prompt, no stack hints, no install script. The workflow auto-detects your stack (npm/yarn/pnpm, uv/pip, go) and installs deps.
  • Codebase-aware. A single stack-agnostic prompt (bundled here) detects the language and reads your repo's own AGENTS.md / CLAUDE.md / .agents/rules/ for conventions.
  • Never blocks. The review is always posted as a non-blocking COMMENT. The model's verdict is shown as advisory text (Verdict: Changes suggested, 2 issues, 1 suggestion), so resolving threads is clean and nothing wedges your merge.
  • Low noise. It reviews only what changed since its last pass, debounces a burst of pushes into one review, opens inline threads only for findings at or above a severity floor (nitpicks go in the body by default), caps inline threads per run, and pauses on draft or a codex:pause label. See "Reducing thread churn" below.
  • Consistent comments.Conventional Comments (issue / suggestion / nitpick), each with a one-line subject, a required why, and a concrete fix. No emoji.
  • Maintained centrally. Change the review behavior for every repo by editing the prompt here, not by touching each consumer.

Quick start (2 steps)

1. Add the auth secret

Add CODEX_ACCESS_TOKEN at the org level (one-time, shared by all repos) under Settings → Secrets and variables → Actions. Use a static credential: an OpenAI API key (sk-*), an agent-identity JWT, or a personal access token (at-*).

Prefer CODEX_ACCESS_TOKEN for CI. It has no rotating refresh token, so concurrent PR reviews across repos cannot race it. CODEX_AUTH_JSON (a full ~/.codex/auth.json) is a fallback only: its single-use refresh token breaks under concurrent CI runs with "refresh token already used" / 401.

2. Add the caller workflow

Create .github/workflows/pr-review.yml — this is the entire integration, identical in every repo:

name: PR Reviewon:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]permissions:
contents: readpull-requests: writeissues: write# The reusable workflow manages its own per-PR concurrency and debounce, so a# caller-level concurrency block is optional. This one cancels superseded caller# runs early to save minutes on a burst of pushes.concurrency:
group: codex-pr-review-${{ github.event.pull_request.number }}cancel-in-progress: truejobs:
codex-review:
# Same-repo guard: never runs for fork PRs, keeping credentials away from# untrusted code. (Don't add workflow_dispatch to a `pull_request` caller:# an arbitrary PR number would bypass this guard. See "Fork PRs" below.)if: >- github.event.pull_request.head.repo.full_name == github.repository && github.event.pull_request.draft == falseuses: modsy/ci-workflows/.github/workflows/codex-pr-review.yml@v1.0.0with:
pr_number: ${{ github.event.pull_request.number }}secrets:
CODEX_AUTH_JSON: ${{ secrets.CODEX_AUTH_JSON }}

That's it. Open a PR and the reviewer comments within a minute or two. Do not add a prompt — it's bundled here and applied to every caller.


How it works

  1. Your caller triggers on pull_request and calls this reusable workflow.
  2. The workflow:
    • Checks out the PR merge commit (persist-credentials: false, so the token can't push or fetch).
    • Fetches PR metadata and any linked issues for context. Codex runs the git diff itself against the checkout; the diff is not pasted into the prompt.
    • Decides whether to review. Skips if this exact HEAD was already reviewed, if the PR is a draft, or if it carries codex:pause. Otherwise it debounces: it pauses briefly and exits if a newer commit has landed, so a burst of pushes collapses to one review. When a prior review exists, it reviews only the increment since that commit.
    • Auto-installs dependencies by detecting a root manifest: package-lock.jsonnpm ci (and builds workspaces if it's a monorepo), yarn.lock / pnpm-lock.yaml, uv.lockuv sync, requirements.txt / pyproject.toml → pip, go.modgo mod download. Best-effort and continue-on-error: if it can't install, the review still runs statically.
    • Loads the review prompt from this repo (version-locked to the workflow's own commit), never from the PR under review.
    • Runs the Codex CLI in an ephemeral sandbox and parses its JSON output.
    • Posts a single non-blocking COMMENT review. Findings at or above the severity floor open inline threads (capped per run and deduped against prior bot comments); lower-severity, overflow, non-diff, and docs/test-only findings are listed in the body.

Inputs

InputRequiredDefaultDescription
pr_numberNoautoPR to review. Resolved from the triggering event; the caller above passes it explicitly.
codex_versionNo0.142.0Pinned @openai/codex version.
pre_install_commandNo""Optional override for dependency setup. Leave empty for auto-detect. Set only for non-standard layouts (e.g. a package nested in a monorepo subdir).
inline_min_severityNosuggestionMinimum severity that opens an inline thread (blocking/suggestion/nitpick). Findings below the floor go under "Minor notes" in the body. The default keeps nitpicks out of threads.
max_inline_commentsNo10Cap on inline threads per run. Highest-severity findings stay inline; the rest are listed in the body.
debounce_secondsNo30Pause at job start, then re-resolve the PR head. If a newer commit landed, the run exits so a burst of pushes collapses to one review. Set 0 to disable.

Reducing thread churn. The reviewer skips while a PR is a draft or carries the codex:pause label, and resumes when the PR is marked ready or the label is removed. Docs/test-only increments post as summary notes with no inline threads. These behaviors are advisory and never block merge.

Secrets

Provide one (org-level recommended):

SecretWhen to use
CODEX_ACCESS_TOKENPreferred. A static credential: OpenAI API key (sk-*), agent-identity JWT, or personal access token (at-*). No rotating refresh token, so concurrent CI runs cannot race it.
CODEX_AUTH_JSONFallback only. Full ~/.codex/auth.json; its single-use refresh token breaks under concurrent CI runs ("refresh token already used" / 401).

Outputs

OutputDescription
review_urlURL of the posted PR review.

Customizing reviews

There is one prompt for all repos: .github/codex/prompts/codex-pr-review.md.

  • Change it for everyone: edit the prompt here and open a PR.
  • Tune it for one repo: document the convention in that repo's AGENTS.md / CLAUDE.md — the prompt reads them at review time.

You should never need a prompt file in a consuming repo.


Security model

ConcernHow it's addressed
Secret isolationAuth secrets are stored per org/repo and passed at call time. Never stored here.
Prompt integrityThe prompt is read from this repo at the workflow's own commit, never from the PR — a PR can't change what the credentialed reviewer runs.
Fork exfiltrationThe caller's same-repo if: guard prevents the workflow (and its secrets) from running on fork PRs. See "Fork PRs" below for the pull_request_target case.
Credential leak via gitpersist-credentials: false keeps GITHUB_TOKEN out of git config.
Script injectionGitHub context values reach the shell only as environment variables, never interpolated into run: blocks.
SandboxCodex runs --ephemeral --sandbox workspace-write: no persistent state, writes scoped to the workspace.

Fork PRs

Whether workflow_dispatch is safe on a caller depends entirely on its trigger. There is no single rule, so pick the row that matches your repo.

Your repoTriggerworkflow_dispatchExample
Never receives fork PRspull_requestOptional. There is no fork guard to bypass, so it only skips the draft check.pr-review-internal.yml
Receives fork PRs, don't review thempull_request + same-repo if:No. Dispatch runs in base context with secrets against an operator-supplied pr_number, which is precisely the bypass the guard exists to prevent.the quick-start caller above
Receives fork PRs, want them reviewedpull_request_target + same-repo if:Yes, and it is the only way in. Read the caveat below first.pr-review-with-fork-guard.yml

Most repos are row 2. Reach for pull_request_target only if you genuinely need fork PRs reviewed, and understand what you are accepting.

The pull_request_target caveat. That trigger runs in the base-branch context and has repo secrets, which is why fork review is possible at all. The same-repo if: blocks automatic runs on forks; workflow_dispatch is the deliberate hatch so a maintainer can review a fork PR by hand. But the reviewer still checks out refs/pull/N/merge, which is the fork's code. The only thing standing between a malicious fork and your secrets is a maintainer having actually read the diff before dispatching. That is a real control, and a human one. Do not treat it as equivalent to the same-repo guard.


Versioning

Pin callers to an immutable patch tag:

uses: modsy/ci-workflows/.github/workflows/codex-pr-review.yml@v1.0.0

These workflows run with the caller's secrets and pull-requests: write. An immutable tag is the only ref where adopting a new reviewer version requires a change in the consuming repo, which is the point of pinning. A commit SHA works identically.

Do not use @main: every merge here would reach every consumer immediately.

A moving v1 alias exists and is repointed at each release. It is a convenience for consumers who accept automatic adoption, not the recommended ref: because a tag can be re-pointed, @v1 still lets a new version land in a credentialed job with no PR in the consuming repo.

Cutting a release

git tag -a v1.x.y -m "<summary>"&& git push origin v1.x.y
git tag -f v1 v1.x.y && git push -f origin v1

Then bump the pinned tag in each consumer via PR. Consumers on @v1 pick it up with no action, and no review.

Troubleshooting

SymptomCause / fix
Review never appearsConfirm CODEX_AUTH_JSON (or CODEX_ACCESS_TOKEN) is set and visible to the repo. The codex-review job's auth step fails fast without it.
Either CODEX_ACCESS_TOKEN or CODEX_AUTH_JSON secret is requiredNo auth secret reached the workflow. Add it at the org or repo level.
refresh token already used / intermittent 401You are on the CODEX_AUTH_JSON fallback; its single-use refresh token is being raced by concurrent CI runs. Switch to a static CODEX_ACCESS_TOKEN.
401 from api.openai.com/v1/responsesAn sk-* key lacks api.responses.write, or is out of credits. Use an agent-identity JWT / at-* token as CODEX_ACCESS_TOKEN.
invalid agent identity JWT formatCODEX_ACCESS_TOKEN isn't a valid JWT/PAT. Re-mint the token.
Review is shallow / misses conventionsAdd an AGENTS.md or CLAUDE.md to your repo; the prompt reads them for project rules.
Dependencies not installedAuto-detect is best-effort. For a nested monorepo package, set pre_install_command to your install command.
Fork PRs not reviewedIntentional — the same-repo guard keeps secrets away from fork code.

secret-scan: block secrets and flag PII on every PR

A CI-side gate that stops hardcoded secrets (API keys, tokens, private keys, connection strings) from merging, and optionally flags likely PII/PHI for human review. It complements, and does not replace, pre-commit hooks: a pre-commit hook is skipped by --no-verify, IDE commits, and web/API pushes, so this workflow catches everything that actually reaches the PR.

  • Zero config, stack-agnostic. One small caller. gitleaks runs from a directly-downloaded binary (no marketplace action, no license key that org accounts otherwise need).
  • Diff-scoped by default. Scans only the commits the PR introduces, so a pre-existing finding on the base branch does not fail your PR. Set scan_scope: full for a one-time history audit.
  • Blocks by default, deliberately. Unlike the advisory code reviewer, a detected secret fails the check (fail_on_secrets: true). Set it false for report-only mode. Values are redacted in logs and the PR comment.
  • Advisory PII sweep (opt-in).scan_pii: true adds a high-confidence email/SSN/phone regex pass over added lines. It NEVER blocks the merge, regex PII detection is false-positive-prone. True PHI coverage needs a dedicated service and is out of scope for a dependency-free gate.
  • One comment, upserted. Results post to a single marker-tagged PR comment that updates in place, so pushes do not pile up duplicates.

Caller

name: Secret Scanon:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]permissions:
contents: readpull-requests: writejobs:
secret-scan:
if: github.event.pull_request.draft == falseuses: modsy/ci-workflows/.github/workflows/secret-scan.yml@v1.0.0with:
scan_scope: "diff"# or "full"fail_on_secrets: true # false for report-only# scan_pii: true # advisory email/SSN/phone sweep# gitleaks_config: ".gitleaks.toml" # repo-specific rules / allowlist

No secret needs to be configured. See examples/secret-scan.yml and examples/secret-scan-with-fork-guard.yml.

Inputs

InputDefaultPurpose
scan_scope"diff"diff scans the PR's commits; full scans all history on the head.
fail_on_secretstrueFail (block) on a secret finding, or report-only when false.
scan_piifalseEnable the advisory PII sweep. Never blocks regardless of fail_on_secrets.
gitleaks_config""Path to a custom .gitleaks.toml for repo-specific rules or allowlists.
gitleaks_versionpinnedgitleaks release to install. Bump deliberately.

Custom rules and false positives

Point gitleaks_config at a .gitleaks.toml in your repo to add rules (e.g. Django SECRET_KEY, VITE_-prefixed vars, an internal token format) or to allowlist known test fixtures. Inline gitleaks:allow comments and a .gitleaksignore file also suppress specific findings.


Contributing

Maintained by the modsy platform team. Open a PR for changes that benefit consuming teams, and call out any breaking input or behavior change in the description.

About

Shared reusable CI workflows for Lennar engineering teams

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content

Latest commit

History

47 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

ci-workflows

Shared, reusable GitHub Actions workflows for Lennar engineering teams.

The repo is public, so any repo in any org can call these workflows directly — no cross-org setup. The review logic lives here and is maintained once; consuming repos add a tiny caller and nothing else. No secrets are stored here.


codex-pr-review — AI code review on every PR

Automated, codebase-aware code review powered by OpenAI Codex. It behaves like GitHub Copilot's reviewer — inline diff comments plus a summary — with a few deliberate improvements:

  • Zero config. Add one ~20-line caller. No prompt, no stack hints, no install script. The workflow auto-detects your stack (npm/yarn/pnpm, uv/pip, go) and installs deps.
  • Codebase-aware. A single stack-agnostic prompt (bundled here) detects the language and reads your repo's own AGENTS.md / CLAUDE.md / .agents/rules/ for conventions.
  • Never blocks. The review is always posted as a non-blocking COMMENT. The model's verdict is shown as advisory text (Verdict: Changes suggested, 2 issues, 1 suggestion), so resolving threads is clean and nothing wedges your merge.
  • Low noise. It reviews only what changed since its last pass, debounces a burst of pushes into one review, opens inline threads only for findings at or above a severity floor (nitpicks go in the body by default), caps inline threads per run, and pauses on draft or a codex:pause label. See "Reducing thread churn" below.
  • Consistent comments.Conventional Comments (issue / suggestion / nitpick), each with a one-line subject, a required why, and a concrete fix. No emoji.
  • Maintained centrally. Change the review behavior for every repo by editing the prompt here, not by touching each consumer.

Quick start (2 steps)

1. Add the auth secret

Add CODEX_ACCESS_TOKEN at the org level (one-time, shared by all repos) under Settings → Secrets and variables → Actions. Use a static credential: an OpenAI API key (sk-*), an agent-identity JWT, or a personal access token (at-*).

Prefer CODEX_ACCESS_TOKEN for CI. It has no rotating refresh token, so concurrent PR reviews across repos cannot race it. CODEX_AUTH_JSON (a full ~/.codex/auth.json) is a fallback only: its single-use refresh token breaks under concurrent CI runs with "refresh token already used" / 401.

2. Add the caller workflow

Create .github/workflows/pr-review.yml — this is the entire integration, identical in every repo:

name: PR Reviewon:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]permissions:
contents: readpull-requests: writeissues: write# The reusable workflow manages its own per-PR concurrency and debounce, so a# caller-level concurrency block is optional. This one cancels superseded caller# runs early to save minutes on a burst of pushes.concurrency:
group: codex-pr-review-${{ github.event.pull_request.number }}cancel-in-progress: truejobs:
codex-review:
# Same-repo guard: never runs for fork PRs, keeping credentials away from# untrusted code. (Don't add workflow_dispatch to a `pull_request` caller:# an arbitrary PR number would bypass this guard. See "Fork PRs" below.)if: >- github.event.pull_request.head.repo.full_name == github.repository && github.event.pull_request.draft == falseuses: modsy/ci-workflows/.github/workflows/codex-pr-review.yml@v1.0.0with:
pr_number: ${{ github.event.pull_request.number }}secrets:
CODEX_AUTH_JSON: ${{ secrets.CODEX_AUTH_JSON }}

That's it. Open a PR and the reviewer comments within a minute or two. Do not add a prompt — it's bundled here and applied to every caller.


How it works

  1. Your caller triggers on pull_request and calls this reusable workflow.
  2. The workflow:
    • Checks out the PR merge commit (persist-credentials: false, so the token can't push or fetch).
    • Fetches PR metadata and any linked issues for context. Codex runs the git diff itself against the checkout; the diff is not pasted into the prompt.
    • Decides whether to review. Skips if this exact HEAD was already reviewed, if the PR is a draft, or if it carries codex:pause. Otherwise it debounces: it pauses briefly and exits if a newer commit has landed, so a burst of pushes collapses to one review. When a prior review exists, it reviews only the increment since that commit.
    • Auto-installs dependencies by detecting a root manifest: package-lock.jsonnpm ci (and builds workspaces if it's a monorepo), yarn.lock / pnpm-lock.yaml, uv.lockuv sync, requirements.txt / pyproject.toml → pip, go.modgo mod download. Best-effort and continue-on-error: if it can't install, the review still runs statically.
    • Loads the review prompt from this repo (version-locked to the workflow's own commit), never from the PR under review.
    • Runs the Codex CLI in an ephemeral sandbox and parses its JSON output.
    • Posts a single non-blocking COMMENT review. Findings at or above the severity floor open inline threads (capped per run and deduped against prior bot comments); lower-severity, overflow, non-diff, and docs/test-only findings are listed in the body.

Inputs

InputRequiredDefaultDescription
pr_numberNoautoPR to review. Resolved from the triggering event; the caller above passes it explicitly.
codex_versionNo0.142.0Pinned @openai/codex version.
pre_install_commandNo""Optional override for dependency setup. Leave empty for auto-detect. Set only for non-standard layouts (e.g. a package nested in a monorepo subdir).
inline_min_severityNosuggestionMinimum severity that opens an inline thread (blocking/suggestion/nitpick). Findings below the floor go under "Minor notes" in the body. The default keeps nitpicks out of threads.
max_inline_commentsNo10Cap on inline threads per run. Highest-severity findings stay inline; the rest are listed in the body.
debounce_secondsNo30Pause at job start, then re-resolve the PR head. If a newer commit landed, the run exits so a burst of pushes collapses to one review. Set 0 to disable.

Reducing thread churn. The reviewer skips while a PR is a draft or carries the codex:pause label, and resumes when the PR is marked ready or the label is removed. Docs/test-only increments post as summary notes with no inline threads. These behaviors are advisory and never block merge.

Secrets

Provide one (org-level recommended):

SecretWhen to use
CODEX_ACCESS_TOKENPreferred. A static credential: OpenAI API key (sk-*), agent-identity JWT, or personal access token (at-*). No rotating refresh token, so concurrent CI runs cannot race it.
CODEX_AUTH_JSONFallback only. Full ~/.codex/auth.json; its single-use refresh token breaks under concurrent CI runs ("refresh token already used" / 401).

Outputs

OutputDescription
review_urlURL of the posted PR review.

Customizing reviews

There is one prompt for all repos: .github/codex/prompts/codex-pr-review.md.

  • Change it for everyone: edit the prompt here and open a PR.
  • Tune it for one repo: document the convention in that repo's AGENTS.md / CLAUDE.md — the prompt reads them at review time.

You should never need a prompt file in a consuming repo.


Security model

ConcernHow it's addressed
Secret isolationAuth secrets are stored per org/repo and passed at call time. Never stored here.
Prompt integrityThe prompt is read from this repo at the workflow's own commit, never from the PR — a PR can't change what the credentialed reviewer runs.
Fork exfiltrationThe caller's same-repo if: guard prevents the workflow (and its secrets) from running on fork PRs. See "Fork PRs" below for the pull_request_target case.
Credential leak via gitpersist-credentials: false keeps GITHUB_TOKEN out of git config.
Script injectionGitHub context values reach the shell only as environment variables, never interpolated into run: blocks.
SandboxCodex runs --ephemeral --sandbox workspace-write: no persistent state, writes scoped to the workspace.

Fork PRs

Whether workflow_dispatch is safe on a caller depends entirely on its trigger. There is no single rule, so pick the row that matches your repo.

Your repoTriggerworkflow_dispatchExample
Never receives fork PRspull_requestOptional. There is no fork guard to bypass, so it only skips the draft check.pr-review-internal.yml
Receives fork PRs, don't review thempull_request + same-repo if:No. Dispatch runs in base context with secrets against an operator-supplied pr_number, which is precisely the bypass the guard exists to prevent.the quick-start caller above
Receives fork PRs, want them reviewedpull_request_target + same-repo if:Yes, and it is the only way in. Read the caveat below first.pr-review-with-fork-guard.yml

Most repos are row 2. Reach for pull_request_target only if you genuinely need fork PRs reviewed, and understand what you are accepting.

The pull_request_target caveat. That trigger runs in the base-branch context and has repo secrets, which is why fork review is possible at all. The same-repo if: blocks automatic runs on forks; workflow_dispatch is the deliberate hatch so a maintainer can review a fork PR by hand. But the reviewer still checks out refs/pull/N/merge, which is the fork's code. The only thing standing between a malicious fork and your secrets is a maintainer having actually read the diff before dispatching. That is a real control, and a human one. Do not treat it as equivalent to the same-repo guard.


Versioning

Pin callers to an immutable patch tag:

uses: modsy/ci-workflows/.github/workflows/codex-pr-review.yml@v1.0.0

These workflows run with the caller's secrets and pull-requests: write. An immutable tag is the only ref where adopting a new reviewer version requires a change in the consuming repo, which is the point of pinning. A commit SHA works identically.

Do not use @main: every merge here would reach every consumer immediately.

A moving v1 alias exists and is repointed at each release. It is a convenience for consumers who accept automatic adoption, not the recommended ref: because a tag can be re-pointed, @v1 still lets a new version land in a credentialed job with no PR in the consuming repo.

Cutting a release

git tag -a v1.x.y -m "<summary>"&& git push origin v1.x.y
git tag -f v1 v1.x.y && git push -f origin v1

Then bump the pinned tag in each consumer via PR. Consumers on @v1 pick it up with no action, and no review.

Troubleshooting

SymptomCause / fix
Review never appearsConfirm CODEX_AUTH_JSON (or CODEX_ACCESS_TOKEN) is set and visible to the repo. The codex-review job's auth step fails fast without it.
Either CODEX_ACCESS_TOKEN or CODEX_AUTH_JSON secret is requiredNo auth secret reached the workflow. Add it at the org or repo level.
refresh token already used / intermittent 401You are on the CODEX_AUTH_JSON fallback; its single-use refresh token is being raced by concurrent CI runs. Switch to a static CODEX_ACCESS_TOKEN.
401 from api.openai.com/v1/responsesAn sk-* key lacks api.responses.write, or is out of credits. Use an agent-identity JWT / at-* token as CODEX_ACCESS_TOKEN.
invalid agent identity JWT formatCODEX_ACCESS_TOKEN isn't a valid JWT/PAT. Re-mint the token.
Review is shallow / misses conventionsAdd an AGENTS.md or CLAUDE.md to your repo; the prompt reads them for project rules.
Dependencies not installedAuto-detect is best-effort. For a nested monorepo package, set pre_install_command to your install command.
Fork PRs not reviewedIntentional — the same-repo guard keeps secrets away from fork code.

secret-scan: block secrets and flag PII on every PR

A CI-side gate that stops hardcoded secrets (API keys, tokens, private keys, connection strings) from merging, and optionally flags likely PII/PHI for human review. It complements, and does not replace, pre-commit hooks: a pre-commit hook is skipped by --no-verify, IDE commits, and web/API pushes, so this workflow catches everything that actually reaches the PR.

  • Zero config, stack-agnostic. One small caller. gitleaks runs from a directly-downloaded binary (no marketplace action, no license key that org accounts otherwise need).
  • Diff-scoped by default. Scans only the commits the PR introduces, so a pre-existing finding on the base branch does not fail your PR. Set scan_scope: full for a one-time history audit.
  • Blocks by default, deliberately. Unlike the advisory code reviewer, a detected secret fails the check (fail_on_secrets: true). Set it false for report-only mode. Values are redacted in logs and the PR comment.
  • Advisory PII sweep (opt-in).scan_pii: true adds a high-confidence email/SSN/phone regex pass over added lines. It NEVER blocks the merge, regex PII detection is false-positive-prone. True PHI coverage needs a dedicated service and is out of scope for a dependency-free gate.
  • One comment, upserted. Results post to a single marker-tagged PR comment that updates in place, so pushes do not pile up duplicates.

Caller

name: Secret Scanon:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]permissions:
contents: readpull-requests: writejobs:
secret-scan:
if: github.event.pull_request.draft == falseuses: modsy/ci-workflows/.github/workflows/secret-scan.yml@v1.0.0with:
scan_scope: "diff"# or "full"fail_on_secrets: true # false for report-only# scan_pii: true # advisory email/SSN/phone sweep# gitleaks_config: ".gitleaks.toml" # repo-specific rules / allowlist

No secret needs to be configured. See examples/secret-scan.yml and examples/secret-scan-with-fork-guard.yml.

Inputs

InputDefaultPurpose
scan_scope"diff"diff scans the PR's commits; full scans all history on the head.
fail_on_secretstrueFail (block) on a secret finding, or report-only when false.
scan_piifalseEnable the advisory PII sweep. Never blocks regardless of fail_on_secrets.
gitleaks_config""Path to a custom .gitleaks.toml for repo-specific rules or allowlists.
gitleaks_versionpinnedgitleaks release to install. Bump deliberately.

Custom rules and false positives

Point gitleaks_config at a .gitleaks.toml in your repo to add rules (e.g. Django SECRET_KEY, VITE_-prefixed vars, an internal token format) or to allowlist known test fixtures. Inline gitleaks:allow comments and a .gitleaksignore file also suppress specific findings.


Contributing

Maintained by the modsy platform team. Open a PR for changes that benefit consuming teams, and call out any breaking input or behavior change in the description.

About

Shared reusable CI workflows for Lennar engineering teams

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors