Repository navigation
fix(repo-policy-sync): cross-repository apply - #23
Conversation
| f"- `{_markdown_cell(outcome.repository)}` / " | ||
| f"`{_markdown_cell(outcome.policy_id)}`: " | ||
| f"{_markdown_cell(_markdown_details(outcome))}" | ||
| f"{_markdown_cell(outcome.error or 'unknown error')}" |
There was a problem hiding this comment.
So anything else except policy_id and repository will now not be in the markdown cell anymore.
That is wanted?
There was a problem hiding this comment.
yes, intentional. too much noise. link to PR is there, no need to write here what was changed.
There was a problem hiding this comment.
Pull request overview
This PR updates repo-policy-sync to work with a cross-repository bot token that has repo scope by moving certain pull-request mutations off gh pr (GraphQL) and onto gh api REST endpoints, and tightens workflow behavior around bot identity and apply-mode prerequisites.
Changes:
- Switch PR label application and PR body/title updates to
gh apiREST calls (avoidingread:orgrequirements). - Adjust markdown reporting to keep the “Details” section focused on errors only.
- Update the GitHub Actions workflow to set a global bot git identity and fail fast in apply mode when
SCORE_BOT_CLASSIC_PATis missing; update tests accordingly.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| repo_policy_sync/src/github.py | Use REST (gh api) to add PR labels and PATCH PR title/body; parse PR number from created URL. |
| repo_policy_sync/src/reporting.py | Render markdown “Details” section from error outcomes only. |
| repo_policy_sync/tests/test_github.py | Update expectations to reflect REST endpoints for labels and PR updates. |
| repo_policy_sync/tests/test_reporting.py | Update test to assert only errors appear in markdown details. |
| .github/workflows/repo-policy-sync.yml | Configure global bot author identity and require bot PAT in apply mode before running sync. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| def _markdown_details_section(outcomes: tuple[RepositoryOutcome, ...]) -> list[str]: | ||
| detailed = tuple( | ||
| outcome for outcome in outcomes if _markdown_details(outcome) != "—" | ||
| ) | ||
| """Render error details without duplicating the policy pull-request list.""" | ||
|
|
||
| detailed = tuple(outcome for outcome in outcomes if outcome.error) | ||
| if not detailed: |
Summary
Why
GitHub CLI pull-request commands use GraphQL and require read:org for organization-owned repositories. The cross-repository bot deliberately has only the narrower repo scope, which is sufficient for the REST endpoints.
Verification