Skip to content

Commit 62bcdd3

Browse files
committed
fix(agents): Improve git hygiene in adk-pr-triage skill
Update the adk-pr-triage skill instructions for local review to ensure the repository state is correct before squashing, and to prevent the loss of the original author's attribution. - Added an explicit `git fetch origin main` step before PR checkout. - Modified the squash instructions to capture and apply the original author via the `--author` flag during the squashed commit. Change-Id: I646a6e8280e91033806f65d34799347d73b5e063
1 parent e5af12c commit 62bcdd3

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

.agents/skills/adk-pr-triage/SKILL.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,10 @@ If the user selects **Local Review**, run the following structured sequence:
141141
* *What it does*: This script automatically checks the Google CLA signature status again, attempts to update the PR branch on GitHub by rebasing onto `main`, and if rebase-update is blocked, falls back to updating via a merge commit. It handles all outputs and fallbacks gracefully.
142142
2. **Step 1: Checkout the PR to a Local Branch**:
143143
* Branch naming convention: `pr-triage-<pr_number>-[short_desc]` (e.g. `pr-triage-5875-parallelize-tool-union`).
144+
* Fetch the latest main branch from origin before checking out the PR:
145+
```bash
146+
git fetch origin main
147+
```
144148
* Fetch the pull request ref directly from the remote GitHub endpoint:
145149
```bash
146150
git fetch https://github.com/google/adk-python.git pull/<pr_number>/head:pr-triage-<pr_number>-[short_desc]
@@ -156,9 +160,14 @@ If the user selects **Local Review**, run the following structured sequence:
156160
```bash
157161
git log -1 --pretty=%B
158162
```
159-
* **Multiple Commits**: Squash them into a single local commit first, keeping the overall PR Title and PR Body as the exact commit message. An elegant way to squash is:
163+
* **Multiple Commits**: Squash them into a single local commit first, keeping the overall PR Title and PR Body as the exact commit message, AND preserving the original author. An elegant way to squash is:
160164
```bash
161-
git reset --soft $(git merge-base HEAD origin/main) && git commit -m "<PR message>"
165+
# 1. Capture the original author
166+
ORIG_AUTHOR=$(git log -1 --format='%an <%ae>')
167+
168+
# 2. Reset to base and commit with the original author
169+
git reset --soft $(git merge-base HEAD origin/main)
170+
git commit --author="$ORIG_AUTHOR" -m "<PR message>"
162171
```
163172
* Append `"Merge <PR link>"` to the very end of the commit message (separated by a blank line). Use this elegant shell command to do it in one-shot:
164173
```bash

0 commit comments

Comments
 (0)