Skip to content

sync: viewer_repo_role lookup uses the wrong REST shape #16

@davidpoblador

Description

@davidpoblador

`gitcabin sync link` tries to fetch `viewer_permission` from `/repos//`. That field doesn't exist on the REST endpoint — it's a GraphQL Repository.viewerPermission field. REST returns a `permissions` object with `{admin, maintain, push, triage, pull}` booleans for the authenticated user.

Current behavior: the lookup silently falls through to "READ" for every link, which then makes viewer_can_close_or_reopen wrong on synced items the user actually owns.

Fix: either query GraphQL for viewerPermission, or map the REST permissions object to a role string (admin → ADMIN, maintain → MAINTAIN, push → WRITE, triage → TRIAGE, pull → READ).

Also surface a way to override role manually via `gitcabin sync link --role ADMIN`, which already exists but the auto path needs to actually work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions