grocery-app/docs/GITEA_PR_WORKFLOW.md
2026-05-31 02:21:59 -07:00

67 lines
1.8 KiB
Markdown

# Gitea PR Workflow
Use this workflow when creating or merging PRs for this repo. It is designed for Codex and local operators to use the same commands without storing secrets in git.
## One-time token setup
Create a Gitea access token with repository pull request permissions, then set it only in the shell or user environment:
```powershell
$env:GITEA_BASE_URL = "http://192.168.7.78:3000"
$env:GITEA_TOKEN = "<token>"
```
For Codex sandbox sessions, use the ignored local env file when inherited environment variables are not visible:
```powershell
@"
GITEA_BASE_URL=http://192.168.7.78:3000
GITEA_TOKEN=<token>
"@ | Set-Content .codex-local.env
```
Do not commit tokens, paste them into docs, or print them in logs.
Check auth:
```powershell
npm run pr:auth
```
## Create a PR
1. Push the branch first.
2. Inspect the cumulative branch diff against the PR target:
```powershell
git log <base>..HEAD --oneline --decorate
git diff --stat <base>..HEAD
```
3. Write the PR body to a temporary local file. Include the coordination record required by `PROJECT_INSTRUCTIONS.md`.
4. Create the PR:
```powershell
npm run pr:create -- --base <base> --title "<title>" --body-file <body-file>
```
The helper checks for an existing open PR with the same base/head and returns it instead of creating a duplicate.
For stacked work, pass the parent PR branch as `<base>`. For standalone work, pass `main`.
## View or merge a PR
View:
```powershell
npm run pr:view -- --number <pr-number>
```
Merge after explicit operator approval and required checks:
```powershell
npm run pr:merge -- --number <pr-number> --method merge --delete-branch --yes
```
The helper refuses to merge without `--yes`. Use `--method squash` or `--method rebase` only when that is the intended repo workflow.