# Example workflow demonstrating the new feature from Issue #4111 # This workflow shows how PR title and body are automatically defaulted from commit message name: Example - Auto PR Title/Body on: workflow_dispatch: jobs: create-pr-with-auto-defaults: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 # Make some changes - name: Update files run: | echo "Updated content" > example.txt date > timestamp.txt # Create PR with automatic title/body from commit # The PR will have: # Title: "Update AGP sources to the latest" # Body: "_Auto-generated by `dump-sources` Github workflow._" - name: Create Pull Request (Auto Title/Body) 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 # Note: title and body are NOT specified, so they will be # automatically set from the commit message above create-pr-with-custom-values: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 # Make some changes - name: Update files run: | echo "Updated content" > example.txt # Create PR with custom title/body (overrides auto-default) # The PR will have the custom values below, NOT the commit message - name: Create Pull Request (Custom Title/Body) 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/custom-pr delete-branch: true create-pr-multiple-commits: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 # Make multiple commits - name: Create multiple commits run: | git config user.name "github-actions[bot]" git config user.email "41898282+github-actions[bot]@users.noreply.github.com" echo "First change" > file1.txt git add file1.txt git commit -m "First commit" echo "Second change" > file2.txt git add file2.txt git commit -m "Second commit" # Create PR - will use default title/body since there are multiple commits # The PR will have: # Title: "Changes by create-pull-request action" # Body: "Automated changes by [create-pull-request](...) GitHub action" - name: Create Pull Request (Multiple Commits) uses: peter-evans/create-pull-request@v7 with: branch: actions/multiple-commits delete-branch: true # Note: Multiple commits means auto-default doesn't apply