NAME

App::GHGen::Generator - Generate GitHub Actions workflows

SYNOPSIS

use App::GHGen::Generator qw(generate_workflow);
use Path::Tiny;

my $yaml = generate_workflow('perl');
path('.github/workflows/ci.yml')->spew_utf8($yaml);

FUNCTIONS

generate_workflow($type)

Generate a complete GitHub Actions workflow YAML string for the given project type.

Purpose

Dispatch to the appropriate language-specific workflow generator and return the resulting YAML string ready to be written to a .github/workflows/ file.

Arguments

$type (Str, required)

A project-type identifier. Supported values: perl, node, python, rust, go, ruby, java, cpp, php, docker, static.

Returns

A multi-line YAML string beginning with --- when $type is recognised, or undef when the type is not supported.

Side Effects

The perl type reads the current directory to detect project requirements (via App::GHGen::PerlCustomizer).

Usage Example

use App::GHGen::Generator qw(generate_workflow);
my $yaml = generate_workflow('node') // die "unsupported type";
path('.github/workflows/ci.yml')->spew_utf8($yaml);

API SPECIFICATION

Input

{ type => { type => 'scalar', required => 1 } }

Output

known type   → { type => 'scalar' }   # YAML string
unknown type → undef

FORMAL SPECIFICATION

SupportedTypes ≔ { perl, node, python, rust, go, ruby, java, cpp, php, docker, static }

generate_workflow : ℤ* → ℤ* ∪ { ⊥ }

t ∈ SupportedTypes → generators[t]()    (non-empty YAML string)
t ¬in; SupportedTypes → ⊥                  (undef)

list_workflow_types()

Return a flat hash of all supported workflow types and their descriptions.

Purpose

Enumerate every type that generate_workflow can handle, with a one-line human-readable description for each.

Arguments

None.

Returns

A flat hash (not a reference) mapping type strings to description strings. Contains exactly eleven entries: perl, node, python, rust, go, ruby, java, cpp, php, docker, static.

Side Effects

None. Pure function.

Usage Example

my %types = list_workflow_types();
say "$_: $types{$_}" for sort keys %types;

API SPECIFICATION

Input

# No parameters.

Output

{ type => 'hashref', keys => { '*' => { type => 'scalar' } } }

FORMAL SPECIFICATION

list_workflow_types : → ℤ* → ℤ*

result ≔ { t ↦ desc(t) ∣ t ∈ SupportedTypes }
|result| = 11

AUTHOR

Nigel Horne <njh@nigelhorne.com>

https://github.com/nigelhorne

LICENSE

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

1 POD Error

The following errors were encountered while parsing the POD:

Around line 76:

Non-ASCII character seen before =encoding in '→'. Assuming UTF-8