|
| 1 | +--- |
| 2 | +name: create-pr |
| 3 | +description: Create a pull request for the current branch with proper labels and description |
| 4 | +disable-model-invocation: true |
| 5 | +allowed-tools: Bash, Read, Glob |
| 6 | +argument-hint: "[--real] [additional labels...]" |
| 7 | +--- |
| 8 | + |
| 9 | +Create a pull request for the current branch following the Datadog Agent contributing guidelines. |
| 10 | + |
| 11 | +## Instructions |
| 12 | + |
| 13 | +1. **Check the current branch** and ensure it's not `main` |
| 14 | +2. **Get the commits** on this branch compared to `main` using `git log main..HEAD` |
| 15 | +3. **Get the diff** using `git diff main..HEAD` to understand all changes |
| 16 | +4. **Read the PR template** from `.github/PULL_REQUEST_TEMPLATE.md` |
| 17 | +5. **Push the branch** to origin if needed |
| 18 | +6. **Open the PR**: By default, open as **Draft** using `gh pr create --draft`. If `$ARGUMENTS` contains `--real`, open as a regular (non-draft) PR instead (omit the `--draft` flag). Remove `--real` from `$ARGUMENTS` before processing remaining arguments as labels. |
| 19 | +7. **PR title**: Use [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) format, prefixed with the general area of change. Examples: |
| 20 | + - `fix(e2e): Fix flaky diagnose test` |
| 21 | + - `feat(logs): Add new log pipeline` |
| 22 | + - `refactor(config): Simplify endpoint resolution` |
| 23 | +8. **Labels**: Choose appropriate labels (plus any additional labels passed as $ARGUMENTS): |
| 24 | + - If the PR only changes tests, docs, CI config, or developer tooling (no Agent binary code changes), use `changelog/no-changelog` and `qa/no-code-change` |
| 25 | + - If the PR changes Agent binary code and QA was done, use `qa/done` |
| 26 | + - If the PR changes Agent binary code, a reno release note is expected (remind the user) |
| 27 | + - Add `backport/<branch-name>` if the user asks for a backport |
| 28 | +9. **PR body**: Fill in the PR template sections: |
| 29 | + - **What does this PR do?**: A clear description of what is changed. Must be readable independently, tying back to the changed code. |
| 30 | + - **Motivation**: A reason why the change is made. Point to an issue if applicable. Include drawbacks or tradeoffs if any. |
| 31 | + - **Describe how you validated your changes**: How you validated the change (tests added/run, benchmarks, manual testing). Only needed when testing included work not covered by test suites. |
| 32 | + - **Additional Notes**: Any extra context, links to predecessor PRs if part of a chain, notes that make code understanding easier. |
| 33 | + |
| 34 | +## PR Description Guidelines (from CONTRIBUTING.md) |
| 35 | + |
| 36 | +The PR description should incorporate everything reviewers and future maintainers need: |
| 37 | +- A description of what is changed |
| 38 | +- A reason why the change is made (pointing to an issue is a good reason) |
| 39 | +- When testing had to include work not covered by test suites, a description of how you validated your change |
| 40 | +- Any relevant benchmarks |
| 41 | +- Additional notes that make code understanding easier |
| 42 | +- If part of a chain of PRs, point to the predecessors |
| 43 | +- If there are drawbacks or tradeoffs, raise them |
| 44 | + |
| 45 | +## Example |
| 46 | + |
| 47 | +```bash |
| 48 | +gh pr create --draft \ |
| 49 | + --title "fix(e2e): Fix flaky diagnose test by adding missing fakeintake redirect" \ |
| 50 | + --label "changelog/no-changelog" \ |
| 51 | + --label "qa/no-code-change" \ |
| 52 | + --body "$(cat <<'EOF' |
| 53 | +### What does this PR do? |
| 54 | +
|
| 55 | +<description of changes> |
| 56 | +
|
| 57 | +### Motivation |
| 58 | +
|
| 59 | +<why this change is needed> |
| 60 | +
|
| 61 | +### Describe how you validated your changes |
| 62 | +
|
| 63 | +<testing done> |
| 64 | +
|
| 65 | +### Additional Notes |
| 66 | +
|
| 67 | +<any extra context> |
| 68 | +EOF |
| 69 | +)" |
| 70 | +``` |
| 71 | + |
| 72 | +## Usage |
| 73 | + |
| 74 | +- `/create-pr` — creates a draft PR (default) |
| 75 | +- `/create-pr --real` — creates a non-draft PR |
| 76 | +- `/create-pr --real team/my-team` — non-draft PR with an extra label |
| 77 | + |
| 78 | +## Output |
| 79 | + |
| 80 | +Return the PR URL when done. |
0 commit comments