App-GitHooks-Plugin-NotifyReleasesToSlack
view release on metacpan or search on metacpan
lib/App/GitHooks/Plugin/NotifyReleasesToSlack.pm view on Meta::CPAN
sub run_pre_push
{
my ( $class, %args ) = @_;
my $app = delete( $args{'app'} );
my $stdin = delete( $args{'stdin'} );
my $config = $app->get_config();
$log->info( 'Entering NotifyReleasesToSlack.' );
# Verify that the mandatory config options are present.
my $config_return = verify_config( $config );
return $config_return
if defined( $config_return );
# Check if we are pushing any tags.
my @tags = get_pushed_tags( $app, $stdin );
$log->infof( "Found %s tag(s) to push.", scalar( @tags ) );
if ( scalar( @tags ) == 0 )
{
$log->info( "No tags were found in the list of references to push." );
return $PLUGIN_RETURN_SKIPPED;
lib/App/GitHooks/Plugin/NotifyReleasesToSlack.pm view on Meta::CPAN
),
);
}
return $PLUGIN_RETURN_PASSED;
}
=head1 FUNCTIONS
=head2 verify_config()
Verify that the mandatory options are defined in the current githooksrc config.
my $plugin_return_code = App::GitHooks::Plugin::NotifyReleasesToSlack::verify_config(
$config
);
Arguments:
=over 4
=item * $config I<(mandatory)>
An C<App::GitHooks::Config> object.
=back
=cut
sub verify_config
{
my ( $config ) = @_;
# Check if a Slack post url is defined in the config.
my $slack_post_url = $config->get( 'NotifyReleasesToSlack', 'slack_post_url' );
if ( !defined( $slack_post_url ) )
{
$log->info('No Slack post URL defined in the [NotifyReleasesToSlack] section, skipping plugin.');
return $PLUGIN_RETURN_SKIPPED;
}
( run in 0.611 second using v1.01-cache-2.11-cpan-73692580452 )