@@ -61,14 +61,30 @@ github is configured to automatically create PRs from pushed branches. These PRs
6161
6262## PR Title, Body, and Label Sync (MANDATORY)
6363
64- When creating or updating a PR linked to one or more issues :
64+ On every agent run, for every PR being interacted with :
6565
66661 . Ensure the ** title** accurately reflects all changes in the PR — update it if the scope has changed.
67- 2 . Ensure the ** body** summarises all changes and includes ` Closes #<n> ` for each linked issue.
68- 3 . Copy all issue labels: ` gh issue view <n> --json labels --jq '.labels[].name' ` → ` gh pr edit <n> --add-label "<label>" `
69- 4 . Never remove any label from a PR or issue — GitHub workflows add labels automatically and they must not be removed.
67+ 2 . Ensure the ** body** summarises all changes and includes ` Closes #<n> ` for each linked issue, if any.
68+ 3 . Sync labels from all linked closing issues to the PR:
69+
70+ ``` bash
71+ gh pr view < pr> --repo < owner/repo> --json closingIssuesReferences \
72+ --jq ' .closingIssuesReferences[].number' \
73+ | while IFS= read -r n; do
74+ gh issue view " $n " --repo < owner/repo> --json labels --jq ' .labels[].name' \
75+ || echo " Warning: could not fetch labels for issue $n " >&2
76+ done \
77+ | sort -u \
78+ | grep -vE ' ^(Blocked|On-Hold)$' \
79+ | while IFS= read -r label; do
80+ gh pr edit < pr> --repo < owner/repo> --add-label " $label " \
81+ || echo " Warning: could not add label '$label ' to PR" >&2
82+ done
83+ ```
84+
85+ The ` Blocked ` and ` On-Hold ` labels are explicitly excluded — workflow-control labels must never be synced from an issue to its PR.
7086
71- Repeat after every push or PR update .
87+ 4 . Never remove any label from a PR or issue — GitHub workflows add labels automatically and they must not be removed .
7288
7389## Label Management (MANDATORY)
7490
0 commit comments