Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .github/workflows/ai-pr-review.yml

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

ditto from the tessera branch PR

[ready for review] might get a bit noisy with the number of times I flick this option when testing things like cicd or IAC. To add a handful of paragraphs every time will detract from the overall experience. I'd opt for [opened] then focus on enabling users to make it easy to do manual re-triggers well, since anyone could simply run gh workflow run ...

Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: AI PR review

on:
pull_request:
types: [opened, ready_for_review]

jobs:
review:
uses: ./.github/workflows/pr-review.yml
permissions:
contents: read
pull-requests: write
secrets: inherit
with:
# Load the script from the PR branch so changes to it are tested here.
tools_ref: ${{ github.head_ref }}
74 changes: 74 additions & 0 deletions .github/workflows/pr-review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: AI PR review

# Reusable workflow. Repos opt in by adding a caller workflow, e.g.:
#
# on:
# pull_request:
# types: [opened]
# jobs:
# review:
# uses: fraymio/.github/.github/workflows/pr-review.yml@main
# permissions:
# contents: read
# pull-requests: write
# secrets: inherit
#
# See workflow-templates/ai-pr-review.yml for the full template.

on:
workflow_call:
inputs:
model:
description: "OpenAI model ID"
type: string
default: gpt-6-astra
reasoning_effort:
description: "low | medium | high | xhigh | max"
type: string
default: medium
tools_ref:
description: "Fallback ref of fraymio/.github to load the review script from (only used if job.workflow_sha is unavailable)"
type: string
default: main
secrets:
OPENAI_API_KEY:
required: true

jobs:
review:
# Skip drafts (reviewed on ready_for_review), bots, and fork PRs (no secrets there).
if: >-
!github.event.pull_request.draft &&
github.event.pull_request.user.type != 'Bot' &&
github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
contents: read
pull-requests: write
steps:
# Load the script from the same commit this reusable workflow runs from, so
# a caller pinned to a branch/tag/SHA gets the matching script. Falls back
# to tools_ref where the job.workflow_* context isn't available.
- uses: actions/checkout@v7
with:
repository: ${{ job.workflow_repository || 'fraymio/.github' }}
ref: ${{ job.workflow_sha || inputs.tools_ref }}
sparse-checkout: pr_review
persist-credentials: false

- uses: actions/setup-python@v7
with:
python-version: "3.14"

- run: pip install -r pr_review/requirements.txt

- name: Review PR
run: python pr_review/review.py
env:
GITHUB_TOKEN: ${{ github.token }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
Comment on lines +69 to +70

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm on https://platform.openai.com/api-keys and only see 4 keys, none of which are obviously tied to this workflow. Could you confirm the name of the key/identifier being used here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I created a new project Engineering AI, did you check that? Your link takes me straight to it 😄

OPENAI_MODEL: ${{ inputs.model }}
REASONING_EFFORT: ${{ inputs.reasoning_effort }}
REPOSITORY: ${{ github.repository }}
PR_NUMBER: ${{ github.event.pull_request.number }}
222 changes: 222 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,223 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[codz]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py.cover
*.lcov
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
# Pipfile.lock

# uv
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# uv.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
# poetry.lock
# poetry.toml

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
# pdm.lock
# pdm.toml
.pdm-python
.pdm-build/

# pixi
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
# pixi.lock
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
# in the .venv directory. It is recommended not to include this directory in version control.
.pixi/*
!.pixi/config.toml

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule*
celerybeat.pid

# Redis
*.rdb
*.aof
*.pid

# RabbitMQ
mnesia/
rabbitmq/
rabbitmq-data/

# ActiveMQ
activemq-data/

# SageMath parsed files
*.sage.py

# Environments
.env
.envrc
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Conda environments
conda-meta/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs/Zensical documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
# .idea/

# Abstra
# Abstra is an AI-powered process automation framework.
# Ignore directories containing user credentials, local state, and settings.
# Learn more at https://abstra.io/docs
.abstra/

# Visual Studio Code
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore that
# can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
# and can be added to the global gitignore or merged into this file. However, if you prefer, you
# could uncomment the following to ignore the entire vscode folder
# .vscode/
# Temporary file for partial code execution
tempCodeRunnerFile.py

# Ruff stuff:
.ruff_cache/

# PyPI configuration file
.pypirc

# Marimo
marimo/_static/
marimo/_lsp/
__marimo__/

# Streamlit
.streamlit/secrets.toml
40 changes: 39 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,39 @@
# .github
# .github

Org-wide GitHub config and tooling for fraymio.

## AI PR review

[`.github/workflows/pr-review.yml`](.github/workflows/pr-review.yml) is a reusable workflow that posts an OpenAI review (`gpt-6-astra` by default) as a comment on a PR as soon as it's opened, or when a draft is marked ready. It never approves or blocks. Bot PRs and PRs from forks are skipped.

**Opting a repo in:** add `.github/workflows/ai-pr-review.yml` to the repo. Either copy [`workflow-templates/ai-pr-review.yml`](workflow-templates/ai-pr-review.yml), or pick **AI PR review** under Actions → New workflow. Delete the file to opt out.

```yaml
on:
pull_request:
types: [opened, ready_for_review]
jobs:
review:
uses: fraymio/.github/.github/workflows/pr-review.yml@main
permissions:
contents: read
pull-requests: write
secrets: inherit
# with:
# model: gpt-6-astra
# reasoning_effort: medium # low | medium | high | xhigh | max
```

**Secret:** `OPENAI_API_KEY` as an org secret (Org settings → Secrets → Actions), shared with the opted-in repos. No other token is needed: each repo's built-in `GITHUB_TOKEN` posts the review.

**Local dry run:**

```sh
pip install -r pr_review/requirements.txt
GITHUB_TOKEN=... OPENAI_API_KEY=... REPOSITORY=fraymio/tessera PR_NUMBER=123 DRY_RUN=true \
python pr_review/review.py
```

## Stale PR report

`stale_prs/pr_tracker.py` writes a CSV of PRs that have been open past the review SLA.
1 change: 1 addition & 0 deletions pr_review/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
requests>=2.31
Loading