API-GitForge

 view release on metacpan or  search on metacpan

bin/git-clean-forge-fork  view on Meta::CPAN


=head1 FILES

=over 4

=item $XDG_CONFIG_HOME/.config/gitforge/access_tokens/I<DOMAIN>

Where I<DOMAIN> is the domain name of the git forge
(e.g. "github.com", "salsa.debian.org"), this file should contain an
API access token to log in to your account at the git forge.  If
unset, $XDG_CONFIG_HOME defaults to ~/.config.

=back

=head1 SEE ALSO

git-nuke-forge-fork(1), git-clean-forge-repo(1)

=head1 AUTHOR

Sean Whitton <spwhitton@spwhitton.name>

bin/git-clean-forge-repo  view on Meta::CPAN


=head1 FILES

=over 4

=item $XDG_CONFIG_HOME/.config/gitforge/access_tokens/I<DOMAIN>

Where I<DOMAIN> is the domain name of the git forge
(e.g. "github.com", "salsa.debian.org"), this file should contain an
API access token to log in to your account at the git forge.  If
unset, $XDG_CONFIG_HOME defaults to ~/.config.

=back

=head1 SEE ALSO

git-clean-forge-fork(1)

=head1 AUTHOR

Sean Whitton <spwhitton@spwhitton.name>

bin/git-nuke-forge-fork  view on Meta::CPAN


=head1 FILES

=over 4

=item $XDG_CONFIG_HOME/.config/gitforge/access_tokens/I<DOMAIN>

Where I<DOMAIN> is the domain name of the git forge
(e.g. "github.com", "salsa.debian.org"), this file should contain an
API access token to log in to your account at the git forge.  If
unset, $XDG_CONFIG_HOME defaults to ~/.config.

=back

=head1 SEE ALSO

git-clean-forge-fork(1)

=head1 AUTHOR

Sean Whitton <spwhitton@spwhitton.name>

lib/API/GitForge.pm  view on Meta::CPAN


    my $ourlab = API::GitForge::new_from_domain(
        domain     => "ourlab.com",
        access_key => API::GitForge::forge_access_token("ourlab.com")
    );

=head2 forge_access_token $domain

Return access token for forge at C<$domain>, assumed to be stored
under C<$ENV{XDG_CONFIG_HOME}/gitforge/access_tokens/$domain> where
the environment variable defaults to C<~/.config> if unset.

=head2 remote_forge_info $remote

Look at the URL for git remote C<$remote>, as returned by C<git remote
get-url>, assume that this remote is a git forge, and return the
domain name of that forge and the path to the repository.

    system qw(git remote add salsa https://salsa.debian.org/spwhitton/foo);
    my ($forge_domain, $forge_repo) = API::GitForge::remote_forge_info("salsa");

lib/API/GitForge/GitHub.pm  view on Meta::CPAN


    $fork->{parent}{full_name} eq $upstream
      or croak
      "$user/$repo does not have parent $upstream; don't know what to do";
}

sub _clean_config_repo {
    my ($self, $target) = @_;
    my ($org,  $repo)   = _extract_repo($target);
    my $repos = $self->{_api}->repos;
    $repos->set_default_user_repo($org, $repo);
    $repos->update({
        name          => "$repo",
        has_wiki      => 0,
        has_issues    => 0,
        has_downloads => 0,
        has_pages     => 0,
        has_projects  => 0,
    });
}

sub _clean_config_fork {
    my ($self, $upstream) = @_;
    my (undef, $repo)     = _extract_repo($upstream);
    my $user = $self->{_api}->user->show->{login};

    my $repos = $self->{_api}->repos;
    $repos->set_default_user_repo($user, $repo);
    $repos->update({
        name           => "$repo",
        homepage       => "",
        description    => "Temporary fork for pull request(s)",
        default_branch => "gitforge",
    });

    $self->_clean_config_repo("$user/$repo");
}

sub _ensure_repo {
    my ($self, $target) = @_;
    my ($org,  $repo)   = _extract_repo($target);
    my $repos       = $self->{_api}->repos;
    my $user        = $self->{_api}->user->show->{login};

lib/API/GitForge/GitLab.pm  view on Meta::CPAN

}

sub _clean_config_fork {
    my ($self, $upstream) = @_;
    my (undef, $repo)     = _extract_project_id($upstream);
    my $user = $self->{_api}->current_user->{username};

    $self->{_api}->edit_project(
        "$user/$repo",
        {
            default_branch      => "gitforge",
            description         => "Temporary fork for merge request(s)",
            issues_access_level => "disabled",
            # merge requests have to be enabled in the fork in order
            # to submit merge requests to the upstream repo from which
            # we forked, it seems
            merge_requests_access_level => "enabled",
        });
}

sub _ensure_repo {



( run in 0.437 second using v1.01-cache-2.11-cpan-0a6323c29d9 )