From c8c273056aba79f86fe5bd349c6dffb15d9c4348 Mon Sep 17 00:00:00 2001 From: Yanick Champoux Date: Sun, 12 Nov 2023 13:21:38 -0500 Subject: [PATCH] add test to check if branch is ready for merging --- t/merge-ready/perltidy.t | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 t/merge-ready/perltidy.t diff --git a/t/merge-ready/perltidy.t b/t/merge-ready/perltidy.t new file mode 100644 index 0000000..f2cad2f --- /dev/null +++ b/t/merge-ready/perltidy.t @@ -0,0 +1,23 @@ +use 5.32.0; + +use Test2::V0; + +use Git::Wrapper; +use Test::PerlTidy qw( run_tests ); + +my $target_branch = $ENV{TARGET_BRANCH} // 'main'; + +my $git = Git::Wrapper->new('.'); + +my $on_target = grep { "* $target_branch" eq $_ } $git->branch; + +if ($on_target) { + run_tests(); +} +else { + my @files = + $git->diff( { name_only => 1, diff_filter => 'ACMR' }, $target_branch ); + ok Test::PerlTidy::is_file_tidy($_), $_ for @files; +} + +done_testing;