# Default PR Title and Body from Commit Message When creating a pull request with a single commit, the action will automatically default the PR title and body to match the commit message, similar to how GitHub's web interface behaves. ## Behavior ### Single Commit PRs When the following conditions are met: - The pull request branch contains exactly **one commit** - The `title` input is not provided (uses default value) - The `body` input is not provided (uses default value) The action will: - Use the commit's **subject line** as the PR title - Use the commit's **body** as the PR description (if the commit has a body) ### Example Given a commit with this message: ``` Update AGP sources to the latest _Auto-generated by `dump-sources` Github workflow._ ``` The following workflow configuration: ```yml - uses: peter-evans/create-pull-request@v7 with: commit-message: | Update AGP sources to the latest _Auto-generated by `dump-sources` Github workflow._ branch: actions/dump-sources delete-branch: true ``` Will create a pull request with: - **Title**: `Update AGP sources to the latest` - **Body**: `_Auto-generated by `dump-sources` Github workflow._` ### Multiple Commits When the pull request branch contains **multiple commits**, the action will use the default values: - **Title**: `Changes by create-pull-request action` - **Body**: `Automated changes by [create-pull-request](https://github.com/peter-evans/create-pull-request) GitHub action` ### Custom Title and Body If you explicitly provide `title` or `body` inputs, those values will always be used regardless of the number of commits: ```yml - uses: peter-evans/create-pull-request@v7 with: commit-message: | Update AGP sources to the latest _Auto-generated by `dump-sources` Github workflow._ title: Custom PR Title body: Custom PR Description branch: actions/dump-sources ``` This will create a PR with your custom title and body, ignoring the commit message. ## Benefits This feature eliminates the need to duplicate commit messages in the workflow configuration: ### Before (Duplicated Content) ```yml - uses: peter-evans/create-pull-request@v7 with: commit-message: | Update AGP sources to the latest _Auto-generated by `dump-sources` Github workflow._ title: Update AGP sources to the latest body: _Auto-generated by `dump-sources` Github workflow._ branch: actions/dump-sources ``` ### After (Simplified) ```yml - uses: peter-evans/create-pull-request@v7 with: commit-message: | Update AGP sources to the latest _Auto-generated by `dump-sources` Github workflow._ branch: actions/dump-sources ``` ## Edge Cases ### Commit with Empty Body If a commit has only a subject line (no body), the PR will use: - **Title**: The commit subject - **Body**: The default body text Example commit: ``` Update files ``` Results in: - **Title**: `Update files` - **Body**: `Automated changes by [create-pull-request](https://github.com/peter-evans/create-pull-request) GitHub action` ### Commit with Multi-line Body Multi-line commit bodies are fully preserved in the PR description: Example commit: ``` Update documentation This is a detailed commit message. It has multiple paragraphs. - Item 1 - Item 2 ``` Results in a PR with the full multi-line body as the description.