Skip to content

Auto-accept GitHub invitation after dataset creation #43

Closed

Description

@neuromechanist

Summary

Users are added as collaborators when a dataset is created, but must manually accept the GitHub invitation in their browser before they can push. This adds friction.

Solution

Auto-accept the invitation via CLI using GitHub API:

gh api /user/repository_invitations  # List pending
gh api --method PATCH /user/repository_invitations/{id}  # Accept

Validated Approach

See .context/validated_workflows.md section 7 (GitHub Invitation Auto-Accept).

# Combined: find and accept invitation for a specific repo
INVITATION_ID=$(gh api /user/repository_invitations --jq '.[] | select(.repository.full_name == "nemarDatasets/<repo>") | .id')
gh api --method PATCH /user/repository_invitations/$INVITATION_ID

Gotchas

  • gh CLI must be authenticated as the invited user
  • macOS keyring not accessible via SSH; use token-based auth or test locally
  • Fallback: prompt user to accept manually if auto-accept fails

Implementation

  1. After dataset creation API returns, list invitations for current user
  2. Find invitation matching the newly created repo
  3. Accept via PATCH API call
  4. Proceed with git push

Parent Issue

Part of #41

Activity

  1. added 2 commits that reference this issue on Jan 21, 2026
    c48a905
    62c633d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions