Listen to this Post

GitHub pull requests (PRs) are essential for code reviews and collaboration. Automating PR descriptions can save time and improve consistency. Using Amazon Q Developer CLI, you can streamline this process by leveraging AI to generate meaningful PR descriptions.
Prerequisites
- Install Amazon Q Developer CLI (Download here).
- Configure the official GitHub MCP Server in your Q CLI.
- Ensure you have a GitHub repository with a pull request template (optional but recommended).
Steps to Automate PR Descriptions
1. Install and Configure Amazon Q CLI
Run the following commands to set up Q CLI:
Install AWS CLI (if not already installed) curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" unzip awscliv2.zip sudo ./aws/install Configure AWS credentials aws configure Install Amazon Q Developer CLI npm install -g @aws/q-developer-cli Authenticate Q CLI with AWS q auth login
2. Set Up GitHub MCP Server
Add GitHub MCP Server to Q CLI q mcp add github https://api.github.com Verify connection q mcp list
3. Generate a PR Description
Run the following prompt in Q CLI:
q prompt execute --template "github-pr-description"
Prompt Template Used:
Your task is to assist me in preparing a GitHub pull request for this branch. To complete the task, you must: - Create and analyze the diff of this branch compared to the main branch. - Read the pull request template of this repository. - Write a meaningful PR description based on the changes.
4. (Optional) Add a PR Template to Context
If your repo has a PR template, load it into Q CLI:
q context add pr_template.md
You Should Know:
- View Git Diff:
git diff main..your-branch
- List Recent PRs:
gh pr list
- Create PR via GitHub CLI:
gh pr create --title "Your PR " --body "$(q prompt execute --template github-pr-description)"
- Automate with GitHub Actions:
name: Auto PR Description on: pull_request: types: [bash] jobs: generate-description: runs-on: ubuntu-latest steps: </li> <li>uses: actions/checkout@v3 </li> <li>run: | echo "PR_DESCRIPTION=$(q prompt execute --template github-pr-description)" >> $GITHUB_ENV </li> <li>uses: peter-evans/create-pull-request@v4 with: body: ${{ env.PR_DESCRIPTION }}
What Undercode Say:
Automating PR descriptions with Amazon Q Developer CLI enhances productivity by reducing manual effort. Integrating this with GitHub CLI and GitHub Actions ensures seamless workflow automation. For best results, maintain a well-structured PR template and regularly update the AI context.
Expected Output:
A well-formatted GitHub PR description generated automatically, including:
- changes
- Linked issues (if any)
- Compliance with the repository’s PR template
Prediction:
AI-powered PR automation will soon become a standard in DevOps workflows, reducing review times and improving documentation quality.
Relevant URL:
GitHub Pull Requests Prompt for Amazon Q
References:
Reported By: Christian Bonzelet – Hackers Feeds
Extra Hub: Undercode MoN
Basic Verification: Pass ✅


