|
| 1 | +--- |
| 2 | +name: create-java-pr |
| 3 | +description: Create a pull request in sentry-java. Use when asked to "create pr", "prepare pr", "prep pr", "open pr", "ready for pr", "prepare for review", "finalize changes". Handles branch creation, code formatting, API dump, committing, pushing, PR creation, and changelog. |
| 4 | +--- |
| 5 | + |
| 6 | +# Create Pull Request (sentry-java) |
| 7 | + |
| 8 | +Prepare local changes and create a pull request for the sentry-java repo. |
| 9 | + |
| 10 | +## Step 1: Ensure Feature Branch |
| 11 | + |
| 12 | +```bash |
| 13 | +git branch --show-current |
| 14 | +``` |
| 15 | + |
| 16 | +If on `main` or `master`, create and switch to a new branch: |
| 17 | + |
| 18 | +```bash |
| 19 | +git checkout -b <type>/<short-description> |
| 20 | +``` |
| 21 | + |
| 22 | +Derive the branch name from the changes being made. Use `feat/`, `fix/`, `ref/`, etc. matching the commit type conventions. |
| 23 | + |
| 24 | +## Step 2: Format Code and Regenerate API Files |
| 25 | + |
| 26 | +```bash |
| 27 | +./gradlew spotlessApply apiDump |
| 28 | +``` |
| 29 | + |
| 30 | +This is **required** before every PR in this repo. It formats all Java/Kotlin code via Spotless and regenerates the `.api` binary compatibility files. |
| 31 | + |
| 32 | +If the command fails, diagnose and fix the issue before continuing. |
| 33 | + |
| 34 | +## Step 3: Commit Changes |
| 35 | + |
| 36 | +Check for uncommitted changes: |
| 37 | + |
| 38 | +```bash |
| 39 | +git status --porcelain |
| 40 | +``` |
| 41 | + |
| 42 | +If there are uncommitted changes, invoke the `sentry-skills:commit` skill to stage and commit them following Sentry conventions. |
| 43 | + |
| 44 | +**Important:** When staging, ignore changes that are only relevant for local testing and should not be part of the PR. Common examples: |
| 45 | + |
| 46 | +| Ignore Pattern | Reason | |
| 47 | +|---|---| |
| 48 | +| Hardcoded booleans flipped for testing | Local debug toggles | |
| 49 | +| Sample app config changes (`sentry-samples/`) | Local testing configuration | |
| 50 | +| `.env` or credentials files | Secrets | |
| 51 | + |
| 52 | +Restore these files before committing: |
| 53 | + |
| 54 | +```bash |
| 55 | +git checkout -- <file-to-restore> |
| 56 | +``` |
| 57 | + |
| 58 | +## Step 4: Push the Branch |
| 59 | + |
| 60 | +```bash |
| 61 | +git push -u origin HEAD |
| 62 | +``` |
| 63 | + |
| 64 | +If the push fails due to diverged history, ask the user how to proceed rather than force-pushing. |
| 65 | + |
| 66 | +## Step 5: Create PR |
| 67 | + |
| 68 | +Invoke the `sentry-skills:create-pr` skill to create a draft PR, then continue to Step 6. |
| 69 | + |
| 70 | +## Step 6: Update Changelog |
| 71 | + |
| 72 | +After the PR is created, add an entry to `CHANGELOG.md` under the `## Unreleased` section. |
| 73 | + |
| 74 | +### Determine the subsection |
| 75 | + |
| 76 | +| Change Type | Subsection | |
| 77 | +|---|---| |
| 78 | +| New feature | `### Features` | |
| 79 | +| Bug fix | `### Fixes` | |
| 80 | +| Refactoring, internal cleanup | `### Internal` | |
| 81 | +| Dependency update | `### Dependencies` | |
| 82 | + |
| 83 | +Create the subsection under `## Unreleased` if it does not already exist. |
| 84 | + |
| 85 | +### Entry format |
| 86 | + |
| 87 | +```markdown |
| 88 | +- <Short description of the change> ([#<PR_NUMBER>](https://github.com/getsentry/sentry-java/pull/<PR_NUMBER>)) |
| 89 | +``` |
| 90 | + |
| 91 | +Use the PR number returned by `sentry-skills:create-pr`. Match the style of existing entries — sentence case, ending with the PR link, no trailing period. |
| 92 | + |
| 93 | +### Commit and push |
| 94 | + |
| 95 | +Stage `CHANGELOG.md`, commit with message `changelog`, and push: |
| 96 | + |
| 97 | +```bash |
| 98 | +git add CHANGELOG.md |
| 99 | +git commit -m "changelog" |
| 100 | +git push |
| 101 | +``` |
0 commit comments