App-GHGen

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

	  but not exported and not called from analyze_workflow).

	[ CI Matrix ]
	- Default Perl matrix is now 5.36, 5.38, 5.40, 5.42 (max_perl_version bumped from
	  5.40 to 5.42). Perl::Critic, perlimports, and coverage steps are now gated on
	  5.42 (always the latest version in the matrix).
	- Perl 5.44 added to the known-versions table as an opt-in. Projects wanting to test
	  against 5.44 before it becomes the default can pass max_perl_version => '5.44' to
	  generate_custom_perl_workflow, or set perl_versions explicitly. No code change
	  needed on the caller's side.
	- POD for generate_custom_perl_workflow updated: max_perl_version default corrected to
	  5.42, opt-in examples for 5.44 added under the max_perl_version item.

0.05	Thu Mar 19 10:36:44 EDT 2026
	- Fix tabs that had crept in

0.04	Wed Mar 18 11:44:12 EDT 2026
	- Bump maximum Perl version
	- Show debug on fail
	- Understand C.
	- Fail better if the project type can't be determined automatically.

scripts/generate_index.pl  view on Meta::CPAN

}

my $timestamp = 'Unknown';
if (my $stat = stat($config{cover_db})) {
	$timestamp = strftime('%Y-%m-%d %H:%M:%S', localtime($stat->mtime));
}

push @html, <<"HTML";
<footer>
	<p>Project: <a href="https://github.com/$config{github_user}/$config{github_repo}">$config{github_repo}</a></p>
	<p><em>Last updated: $timestamp - <a href="$commit_url">commit <code>$short_sha</code></a></em></p>
</footer>

</body>
</html>
HTML

# Write to index.html
write_file($config{output}, join("\n", @html));

# Safe git command execution

t/extended_tests.t  view on Meta::CPAN

	is($n, 0, 'missing on key returns 0 modifications');
};

subtest 'Fixer::update_runners - windows-2016 upgraded to windows-latest' => sub {
	my $wf = {
		jobs => {
			build => { 'runs-on' => 'windows-2016', steps => [] },
		},
	};
	my $n = App::GHGen::Fixer::update_runners($wf);
	is($n, 1,                'one runner updated');
	is($wf->{jobs}{build}{'runs-on'}, 'windows-latest', 'windows-2016 → windows-latest');
};

subtest 'Fixer::update_runners - runner not in update table is unchanged' => sub {
	my $wf = { jobs => { build => { 'runs-on' => 'ubuntu-latest', steps => [] } } };
	my $n = App::GHGen::Fixer::update_runners($wf);
	is($n, 0, 'current runner string produces no modifications');
};

subtest 'Fixer::get_latest_version - unknown action returns fallback v4' => sub {

t/extended_tests.t  view on Meta::CPAN

subtest 'Fixer::apply_fixes - maintenance/outdated action branch fires update_actions' => sub {
	my $wf = {
		jobs => {
			build => {
				steps => [{ uses => 'actions/cache@v3' }],
			},
		},
	};
	my @issues = ({ type => $ISSUE_TYPE{MAINT}, message => '1 outdated action(s)' });
	my $n = apply_fixes($wf, \@issues);
	is($n, 1, 'one action updated');
	is($wf->{jobs}{build}{steps}[0]{uses}, 'actions/cache@v5', 'cache upgraded to v5');
};

subtest 'Fixer::apply_fixes - performance/missing timeout fires add_missing_timeout' => sub {
	my $wf = {
		jobs => {
			build => { 'runs-on' => 'ubuntu-latest', steps => [] },
		},
	};
	my @issues = ({

t/function.t  view on Meta::CPAN

	is($workflow->{jobs}{b}{'timeout-minutes'}, 60, 'job b timeout unchanged');
};

subtest 'Fixer::update_runners - upgrades known outdated runner strings' => sub {
	my $workflow = {
		jobs => {
			test => { 'runs-on' => 'ubuntu-18.04' },
		},
	};
	my $count = App::GHGen::Fixer::update_runners($workflow);
	is($count, 1, 'one runner was updated');
	is(
		$workflow->{jobs}{test}{'runs-on'},
		'ubuntu-latest',
		'ubuntu-18.04 was updated to ubuntu-latest',
	);

	# Current runner must not be changed.
	my $current = { jobs => { test => { 'runs-on' => 'ubuntu-latest' } } };
	is(App::GHGen::Fixer::update_runners($current), 0, 'current runner not touched');
};

subtest 'Fixer::fix_unpinned_actions - replaces @master and @main with versions' => sub {
	my $workflow = {
		jobs => { test => { steps => [

t/integration.t  view on Meta::CPAN

		);

		my $n = fix_workflow($wf_path, \@issues);
		cmp_ok($n, '>=', 1, "fix_workflow applied at least one fix (got $n)");

		# Re-read the YAML from disk and assert the fixes persisted.
		my $reloaded = LoadFile($wf_path);
		ok(defined $reloaded->{concurrency},
			'concurrency key present in reloaded workflow (persisted to disk)');
		isnt($reloaded->{jobs}{build}{'runs-on'}, 'ubuntu-18.04',
			'outdated runner updated in reloaded workflow');

		diag("Reloaded runs-on: $reloaded->{jobs}{build}{'runs-on'}") if $ENV{TEST_VERBOSE};
	});
};

# ---------------------------------------------------------------------------
# Subtest 11: fix_workflow skips DumpFile when no fixes applied
# POD: the file is only rewritten when fix count > 0.
# Spy on DumpFile to confirm it is never called when the issues list is empty.
subtest 'Fixer::fix_workflow: DumpFile not called when zero fixes applied' => sub {



( run in 2.331 seconds using v1.01-cache-2.11-cpan-81fc1098f69 )