API-GitForge

 view release on metacpan or  search on metacpan

CONTRIBUTING  view on Meta::CPAN

Please use the CPAN bug tracker:
<https://rt.cpan.org/Public/Dist/Display.html?Name=API-GitForge>

Please read "How to Report Bugs Effectively" to ensure your bug report
constitutes a useful contribution to the project:
<https://www.chiark.greenend.org.uk/~sgtatham/bugs.html>

Signing off your commits
========================

Contributions are accepted upstream under the terms set out in the
file ``COPYING``.  You must certify the contents of the file
``DEVELOPER-CERTIFICATE`` for your contribution.  To do this, append a
``Signed-off-by`` line to end of your commit message.  An easy way to
add this line is to pass the ``-s`` option to git-commit(1).  Here is
an example of a ``Signed-off-by`` line:

::

    Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>

COPYING  view on Meta::CPAN

covered work, you indicate your acceptance of this License to do so.

  10. Automatic Licensing of Downstream Recipients.

  Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License.  You are not responsible
for enforcing compliance by third parties with this License.

  An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations.  If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.

  You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License.  For example, you may

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");
}



( run in 1.881 second using v1.01-cache-2.11-cpan-49f99fa48dc )