App-GHGen

 view release on metacpan or  search on metacpan

lib/App/GHGen/Fixer.pm  view on Meta::CPAN

    }
    elsif (ref $on eq 'HASH' && $on->{push} && ref $on->{push} eq '') {
        # 'push' with no filters
        $on->{push} = {
            branches => ['main', 'master'],
        };
        $modified++;
    }

    return $modified;
}

sub add_missing_timeout($workflow) {
    my $jobs = $workflow->{jobs} or return 0;
    my $modified = 0;

    for my $job_name (keys %$jobs) {
        my $job = $jobs->{$job_name};

        # Skip if timeout already exists
        next if exists $job->{'timeout-minutes'};

        # Insert default timeout
        $job->{'timeout-minutes'} = 30;
        $modified++;
    }

	return $modified;
}

sub update_runners($workflow) {
	my $jobs = $workflow->{jobs} or return 0;
	my $modified = 0;

    my %runner_updates = (
        'ubuntu-18.04' => 'ubuntu-latest',
        'ubuntu-16.04' => 'ubuntu-latest',
        'macos-10.15'  => 'macos-latest',
        'windows-2016' => 'windows-latest',
    );

    for my $job (values %$jobs) {
        my $runs_on = $job->{'runs-on'} or next;

        if (exists $runner_updates{$runs_on}) {
            $job->{'runs-on'} = $runner_updates{$runs_on};
            $modified++;
        }
    }

    return $modified;
}

sub get_latest_version($action) {
    my %versions = (
        'actions/checkout' => 'v6',
        'actions/cache' => 'v5',
        'actions/setup-node' => 'v4',
        'actions/setup-python' => 'v5',
        'actions/setup-go' => 'v5',
        'actions/upload-artifact' => 'v4',
        'actions/download-artifact' => 'v4',
    );

    return $versions{$action} // 'v4';  # Default fallback
}

=head1 AUTHOR

Nigel Horne E<lt>njh@nigelhorne.comE<gt>

L<https://github.com/nigelhorne>

=head1 COPYRIGHT AND LICENSE

Copyright 2025-2026 Nigel Horne.

Usage is subject to license terms.

The license terms of this software are as follows:

=cut

1;



( run in 1.233 second using v1.01-cache-2.11-cpan-b16cb0d3907 )