Dist-Zilla-Plugin-GitHub-CreateRelease

 view release on metacpan or  search on metacpan

bin/createrelease.pl  view on Meta::CPAN

            target_commitish => $branch,
            name             => $self->get_title(),
            body             => $self->get_notes(),
            draft            => $draft ? JSON::MaybeXS::true : JSON::MaybeXS::false,
            prerelease       => $trial ? JSON::MaybeXS::true : JSON::MaybeXS::false,
            generate_release_notes => $github_notes,
            }
        );

        die "Unable to create release for $identity{login}\\$releases->{repo}" if  ($response->code eq '404');
        #die "Validation failed, or the endpoint has been spammed." if  ($response->code eq '422');
        die "login or token invalid for the specified repository: $identity{login}\\$releases->{repo}\n"
            if  ($response->code eq '403');

        if ($response->code ne '201') {
            my $message = $response->raw_content();
            print "message", $message, "\n";
            $message =~ s/\n/ /gm;
            my $error_message  = decode_json $message;
            for my $error (@{$error_message->{errors}}) {
                print "Field: ", $error->{message}, " - ", $error->{code}, "\n";

lib/Dist/Zilla/Plugin/GitHub/CreateRelease.pm  view on Meta::CPAN

      generate_release_notes => $self->{github_notes} ? \1 : \0,
    }
  );
  # ->response is the underlying HTTP::Response object, not a status code
  # string, so comparing it with `eq '404'`/`eq '422'` never matches and
  # these two checks never fired; every failure fell through to the
  # generic "Unable to create GitHub release" below. ->code (as already
  # used for the 403 check two lines down) delegates to the response's
  # numeric status and is what these comparisons need.
  die "Discussion category name is invalid" if  ($release->code eq '404');
  die "Validation failed, or the endpoint has been spammed." if  ($release->code eq '422');
  die "login ($identity{login}) or token invalid for the specified repository ($releases->{repo})\n"
      if  ($release->code eq '403');

  if (! defined $release->content->{id}) {
    die "Unable to create GitHub release\n";
  }
  $self->log("Release created at $releases->{repo} for $identity{login}");

  my $asset = $releases->assets->create(
    release_id   => $release->content->{id},



( run in 0.447 second using v1.01-cache-2.11-cpan-9789f410c06 )