feat(bot): add support for applying labels to bot-created PRs

- Update the publish workflow to read labels from a pr-labels.txt file and apply them to the PR using the gh CLI.
- Update the prs skill to instruct the bot to write labels to pr-labels.txt.
- Update the issue-fixer and metrics skills to explicitly request the application of their respective labels in pr-labels.txt.
This commit is contained in:
Christian Gunderman
2026-05-13 15:13:46 -07:00
parent 4449f3f43c
commit a6e460e595
4 changed files with 12 additions and 4 deletions
@@ -375,6 +375,14 @@ jobs:
gh pr create --draft --title "🤖 Gemini Bot Productivity Optimizations" --body "Automated changes generated by Gemini CLI Bot." --head "$NEW_BRANCH_NAME" --base main
fi
fi
if [ -s "${{ runner.temp }}/brain-data/pr-labels.txt" ]; then
while IFS= read -r label; do
if [ -n "$label" ]; then
gh pr edit --add-label "$label" || true
fi
done < "${{ runner.temp }}/brain-data/pr-labels.txt"
fi
fi
- name: 'Post PR/Issue Comment'
@@ -29,4 +29,4 @@ maintain existing PRs to reduce the repository backlog.
- **CRITICAL**: `gh issue list` is your ONLY source for new tasks. If `gh` fails, you MUST diagnose the environment or abort the discovery phase. You are STRICTLY FORBIDDEN from using `google_web_search` to query GitHub, as it indexes closed issues. Do NOT run local discovery commands (e.g., `npm run lint`, `npm run typecheck`) to look for "easy fixes".
3. **Select ONE Issue** and implement a fix on a new branch.
4. **Verify** via `npm run preflight`.
5. **Use the `prs` Skill** to stage changes and prepare the draft PR (label: `bot-fix`).
5. **Use the `prs` Skill** to stage changes and prepare the draft PR (labels: `bot-fix`, `issue-fixer`).
@@ -21,7 +21,7 @@ maintainability.
`tools/gemini-cli-bot/history/metrics-before-prev.csv` and the current run's
metrics.
- **Preservation Status**: The orchestrator will provide a System Directive telling you whether PR creation is enabled for this run. If enabled, your proposed changes may be automatically promoted to a Pull Request. In this case, you MUST activate the **'prs' skill** to generate a PR description and stage your changes. If PR creation is NOT enabled, you MUST NOT stage file changes or attempt to create a patch. Instead, simply report your findings.
- **Ownership Mandate**: Any PR generated by this skill MUST use the `bot-fix` label.
- **Ownership Mandate**: Any PR generated by this skill MUST use the `bot-fix` and `metrics` labels in `pr-labels.txt`.
## Repo Policy Priorities
@@ -30,14 +30,14 @@ If you are proposing fixes and PR creation is enabled (per the System Directive)
`pr-description.md`.
- **Title**: The very first line MUST be a concise, conventional title.
- **Body**: Explain the change and expected impact. You MUST identify the domain expert for the affected files and mention them (cc @<user>).
- **Labels**: Always apply the `bot-fix` label.
- **Labels**: Use the `write_file` tool to create `pr-labels.txt` containing one label per line. You MUST ALWAYS add the `bot-fix` label.
3. **Stage Fixes**: You MUST explicitly stage your fixes using the
`git add <files>` command.
4. **Internal File Protection (CRITICAL)**: You are STRICTLY FORBIDDEN from
staging internal bot management files. If they are accidentally staged, you
MUST unstage them using `git reset <file>`.
- **NEVER STAGE**: `pr-description.md`, `lessons-learned.md`,
`branch-name.txt`, `pr-comment.md`, `pr-number.txt`, `issue-comment.md`, or
`branch-name.txt`, `pr-comment.md`, `pr-number.txt`, `issue-comment.md`, `pr-labels.txt`, or
anything in `history/`.
## Unblocking & PR Updates (Recovery)