File Coverage

blib/lib/App/GHGen.pm
Criterion Covered Total %
statement 8 8 100.0
branch n/a
condition n/a
subroutine 3 3 100.0
pod n/a
total 11 11 100.0


line stmt bran cond sub pod time code
1             package App::GHGen;
2              
3             # Try this to update GitHub Marketplace released, but bear in mind it tends to not work, marketplace does not detect the update
4             # Update the @v1 to @v2 in action.yml
5             # git tag -a v2 -m 'Release v0.02'
6             # git push origin v2
7             # Go to https://github.com/nigelhorne/App-GHGen/releases
8             # Click “Draft a new release”
9             # Choose the existing tag: v2
10             # Publish the release
11              
12 1     1   365875 use v5.36;
  1         4  
13 1     1   7 use strict;
  1         2  
  1         52  
14 1     1   6 use warnings;
  1         2  
  1         378  
15              
16             =head1 NAME
17              
18             App::GHGen - GitHub Actions workflow generator, analyzer, and optimizer
19              
20             =head1 VERSION
21              
22             Version 0.05
23              
24             =cut
25              
26             our $VERSION = '0.05';
27              
28             =head1 SYNOPSIS
29              
30             # Generate workflows
31             ghgen generate --auto # Auto-detect project type
32             ghgen generate --type=perl # Generate Perl workflow
33             ghgen generate --type=perl --customize # Interactive customization
34             ghgen generate --interactive # Choose type interactively
35              
36             # Analyze workflows
37             ghgen analyze # Analyze for issues
38             ghgen analyze --fix # Auto-fix issues
39             ghgen analyze --estimate # Show cost estimates
40              
41             # List available types
42             ghgen generate --list
43              
44             =head1 DESCRIPTION
45              
46             GHGen Workflow Analyzer is the all-in-one solution for keeping your GitHub Actions fast,
47             secure, and effortlessly up-to-date.
48             It automatically scans your workflows for performance bottlenecks,
49             outdated actions,
50             missing security permissions, and wasted CI minutes-then applies safe, intelligent fixes or opens a clean pull request with improvements.
51             Whether you maintain a single project or dozens,
52             GHGen saves time, reduces CI costs, and enforces modern best practices without manual effort.
53             Developers choose it because it turns workflow maintenance from a chore into a fully automated,
54             reliable part of their development pipeline.
55              
56             =head2 Key Features
57              
58             =encoding utf-8
59              
60             =over 4
61              
62             =item * B - Intelligently scans your repository to detect language and dependencies
63              
64             =item * B - Creates workflows with caching, security, concurrency, and best practices built-in
65              
66             =item * B - Comprehensive analysis for performance, security, cost, and maintenance issues
67              
68             =item * B - Automatically applies fixes for detected problems (adds caching, updates versions, adds permissions, etc.)
69              
70             =item * B - Guided workflow creation with smart defaults and multi-select options
71              
72             =item * B - Estimates current CI minutes usage and calculates potential savings from optimizations
73              
74             =item * B - Run as a GitHub Action to analyze PRs, comment with suggestions, and create fix PRs
75              
76             =item * B - Detailed analysis of each workflow's cost and optimization potential
77              
78             =back
79              
80             =head1 INSTALLATION
81              
82             =head2 From CPAN
83              
84             cpanm App::GHGen
85              
86             =head2 From Source
87              
88             git clone https://github.com/nigelhorne/App-GHGen.git
89             cd ghgen
90             cpanm --installdeps .
91             perl Makefile.PL
92             make
93             make test
94             make install
95              
96             =head2 Quick Install Script
97              
98             curl -L https://cpanmin.us | perl - App::GHGen
99              
100             =head1 QUICK START
101              
102             The fastest way to get started:
103              
104             # Navigate to your project
105             cd my-project/
106              
107             # Auto-detect and generate workflow
108             ghgen generate --auto
109              
110             # Review the generated workflow
111             cat .github/workflows/*-ci.yml
112              
113             # Commit and push
114             git add .github/workflows/
115             git commit -m "Add CI workflow"
116             git push
117              
118             That's it! GHGen will detect your project type and create an optimized workflow.
119              
120             =head1 WORKFLOW GENERATION
121              
122             =head2 Auto-Detection
123              
124             GHGen can automatically detect your project type by scanning for indicator files:
125              
126             ghgen generate --auto
127              
128             Detection looks for:
129              
130             =over 4
131              
132             =item * B: cpanfile, dist.ini, Makefile.PL, Build.PL, lib/*.pm
133              
134             =item * B: package.json, package-lock.json, yarn.lock
135              
136             =item * B: requirements.txt, setup.py, pyproject.toml
137              
138             =item * B: Cargo.toml, Cargo.lock
139              
140             =item * B: go.mod, go.sum
141              
142             =item * B: Gemfile, Rakefile
143              
144             =item * B: Dockerfile, docker-compose.yml
145              
146             =back
147              
148             If multiple types are detected, it shows alternatives:
149              
150             ✓ Detected project type: PERL
151             Evidence: cpanfile, lib, t
152              
153             Other possibilities:
154             • docker (confidence: 65%)
155              
156             Generate PERL workflow? [Y/n]:
157              
158             =head2 Specify Project Type
159              
160             Generate for a specific language:
161              
162             ghgen generate --type=perl
163             ghgen generate --type=node
164             ghgen generate --type=python
165             ghgen generate --type=rust
166             ghgen generate --type=go
167             ghgen generate --type=ruby
168             ghgen generate --type=docker
169             ghgen generate --type=static
170              
171             =head2 Interactive Mode
172              
173             Choose from a menu of available types:
174              
175             ghgen generate --interactive
176              
177             GitHub Actions Workflow Generator
178             ==================================================
179              
180             Select a project type:
181              
182             1. Node.js/npm
183             2. Python
184             3. Rust
185             4. Go
186             5. Ruby
187             6. Perl
188             7. Docker
189             8. Static site (GitHub Pages)
190              
191             Enter number (1-8):
192              
193             =head2 Interactive Customization
194              
195             Customize workflows with guided prompts:
196              
197             ghgen generate --type=perl --customize
198              
199             For Perl, you'll be asked:
200              
201             =over 4
202              
203             =item * B - Select from 5.22 through 5.40 (multi-select with defaults)
204              
205             =item * B - Ubuntu, macOS, Windows (multi-select)
206              
207             =item * B - Code quality analysis (yes/no)
208              
209             =item * B - Test coverage (yes/no)
210              
211             =item * B - Which branches to run on
212              
213             =back
214              
215             Example session:
216              
217             === Workflow Customization: PERL ===
218              
219             Perl Versions to Test:
220             Which Perl versions?
221             (Enter numbers separated by commas, or 'all')
222             ✓ 1. 5.40
223             ✓ 2. 5.38
224             ✓ 3. 5.36
225             4. 5.34
226             5. 5.32
227              
228             Enter choices [1,2,3]: 1,2,3
229              
230             Operating Systems:
231             Which operating systems?
232             ✓ 1. ubuntu-latest
233             ✓ 2. macos-latest
234             ✓ 3. windows-latest
235              
236             Enter choices [1,2,3]: 1,2
237              
238             Enable Perl::Critic? [Y/n]: y
239             Enable test coverage? [Y/n]: y
240              
241             Each language has its own customization options appropriate to its ecosystem.
242              
243             =head2 List Available Types
244              
245             See all supported project types:
246              
247             ghgen generate --list
248              
249             Available workflow templates:
250              
251             node - Node.js/npm projects with testing and linting
252             python - Python projects with pytest and coverage
253             rust - Rust projects with cargo, clippy, and formatting
254             go - Go projects with testing and race detection
255             ruby - Ruby projects with bundler and rake
256             perl - Perl projects with cpanm, prove, and coverage
257             docker - Docker image build and push workflow
258             static - Static site deployment to GitHub Pages
259              
260             =head1 WORKFLOW ANALYSIS
261              
262             =head2 Basic Analysis
263              
264             Scan all workflows in your repository for issues:
265              
266             ghgen analyze
267              
268             GitHub Actions Workflow Analyzer
269             ==================================================
270              
271             📄 Analyzing: perl-ci.yml
272             ⚠ No dependency caching found - increases build times
273             💡 Fix:
274             - uses: actions/cache@v5
275             with:
276             path: ~/perl5
277             key: ${{ runner.os }}-${{ matrix.perl }}-${{ hashFiles('cpanfile') }}
278              
279             ⚠ Found 2 outdated action(s)
280             💡 Fix:
281             Update to latest versions:
282             actions/cache@v4 → actions/cache@v5
283              
284             ==================================================
285             Summary:
286             Workflows analyzed: 1
287             Total issues found: 2
288              
289             The analyzer checks for:
290              
291             =over 4
292              
293             =item * B
294              
295             =over 8
296              
297             =item - Missing dependency caching (npm, pip, cargo, go, bundler, cpanm)
298              
299             =item - Jobs that could run in parallel
300              
301             =back
302              
303             =item * B
304              
305             =over 8
306              
307             =item - Unpinned action versions (@master, @main)
308              
309             =item - Missing permissions declarations
310              
311             =item - Overly broad permissions (contents: write when read is sufficient)
312              
313             =back
314              
315             =item * B
316              
317             =over 8
318              
319             =item - Missing concurrency controls (wasted CI on superseded runs)
320              
321             =item - Overly broad triggers (runs on every push without filters)
322              
323             =item - Inefficient matrix strategies
324              
325             =back
326              
327             =item * B
328              
329             =over 8
330              
331             =item - Outdated action versions (v4 → v5, v5 → v6)
332              
333             =item - Outdated runner versions (ubuntu-18.04 → ubuntu-latest)
334              
335             =back
336              
337             =back
338              
339             =head2 Auto-Fix
340              
341             Automatically apply fixes to your workflows:
342              
343             ghgen analyze --fix
344              
345             GitHub Actions Workflow Analyzer
346             (Auto-fix mode enabled)
347             ==================================================
348              
349             📄 Analyzing: perl-ci.yml
350             ⚙ Applying 3 fix(es)...
351             ✓ Applied 3 fix(es)
352              
353             ==================================================
354             Summary:
355             Workflows analyzed: 1
356             Total issues found: 3
357             Fixes applied: 3
358              
359             Auto-fix can:
360              
361             =over 4
362              
363             =item * B - Detects project type and adds appropriate dependency caching
364              
365             =item * B - Updates to latest versions (cache@v4→v5, checkout@v5→v6, etc.)
366              
367             =item * B - Converts @master/@main to specific version tags
368              
369             =item * B - Adds C for security
370              
371             =item * B - Adds concurrency groups to cancel superseded runs
372              
373             =item * B - Adds branch and path filters
374              
375             =item * B - Changes ubuntu-18.04 to ubuntu-latest
376              
377             =back
378              
379             The auto-fix feature is safe:
380              
381             =over 4
382              
383             =item * Only fixes well-understood issues
384              
385             =item * Preserves YAML structure and comments
386              
387             =item * Changes are easily reviewable with C
388              
389             =item * Can be reverted if needed
390              
391             =back
392              
393             =head2 Cost Estimation
394              
395             See your current CI usage and potential savings:
396              
397             ghgen analyze --estimate
398              
399             GitHub Actions Workflow Analyzer
400             (Cost estimation mode)
401             ==================================================
402              
403             📊 Estimating current CI usage...
404              
405             Current Monthly Usage:
406             Total CI minutes: 1,247
407             Billable minutes: 0 (after 2,000 free tier)
408             Estimated cost: $0.00
409              
410             Per-Workflow Breakdown:
411             Perl CI 840 min/month (100 runs × 8.4 min/run)
412             Node.js CI 300 min/month ( 60 runs × 5.0 min/run)
413             Docker 107 min/month ( 20 runs × 5.4 min/run)
414              
415             📄 Analyzing: node-ci.yml
416             ⚠ No dependency caching found
417             ⚠ No concurrency group defined
418              
419             ==================================================
420             Summary:
421             Workflows analyzed: 3
422             Total issues found: 2
423              
424             💰 Potential Savings:
425             With recommended changes: 647 CI minutes/month
426             Reduction: -600 minutes (48%)
427             Cost savings: $4.80/month (for private repos)
428              
429             Breakdown:
430             • Adding dependency caching: ~75 min/month
431             • Adding concurrency controls: ~525 min/month
432              
433             The cost estimator considers:
434              
435             =over 4
436              
437             =item * Workflow trigger frequency (push, PR, schedule)
438              
439             =item * Estimated duration per run (based on steps and commands)
440              
441             =item * Matrix build multipliers (e.g., 3 OS × 8 Perl versions = 24 jobs)
442              
443             =item * Parallel vs sequential job execution
444              
445             =item * GitHub Actions pricing ($0.008/minute for private repos, 2000 free minutes/month)
446              
447             =back
448              
449             =head1 GITHUB ACTION INTEGRATION
450              
451             Use GHGen as a GitHub Action to analyze workflows automatically.
452              
453             =head2 Mode 1: Comment on Pull Requests
454              
455             Automatically comment on PRs that modify workflows:
456              
457             # .github/workflows/ghgen-comment.yml
458             name: Analyze Workflows
459              
460             on:
461             pull_request:
462             paths:
463             - '.github/workflows/**'
464              
465             permissions:
466             contents: read
467             pull-requests: write
468              
469             jobs:
470             analyze:
471             runs-on: ubuntu-latest
472             steps:
473             - uses: actions/checkout@v6
474             - uses: nigelhorne/App-GHGen@v1
475             with:
476             github-token: ${{ secrets.GITHUB_TOKEN }}
477             mode: comment
478              
479             This posts a comment like:
480              
481             ## 🔍 GHGen Workflow Analysis
482              
483             | Category | Count | Auto-fixable |
484             |----------|-------|--------------|
485             | ⚡ Performance | 2 | 2 |
486             | 🔒 Security | 1 | 1 |
487              
488             ### 💰 Potential Savings
489             - ⏱️ Save **~650 CI minutes/month**
490             - 💵 Save **~$5/month** (private repos)
491              
492             ### 💡 How to Fix
493             Run locally: `ghgen analyze --fix`
494              
495             =head2 Mode 2: Auto-Fix with Pull Request
496              
497             Automatically create PRs with fixes on a schedule:
498              
499             # .github/workflows/ghgen-autofix.yml
500             name: Weekly Workflow Optimization
501              
502             on:
503             schedule:
504             - cron: '0 9 * * 1' # Monday 9am UTC
505             workflow_dispatch: # Manual trigger
506              
507             permissions:
508             contents: write
509             pull-requests: write
510              
511             jobs:
512             optimize:
513             runs-on: ubuntu-latest
514             steps:
515             - uses: actions/checkout@v6
516             - uses: nigelhorne/App-GHGen@v1
517             with:
518             github-token: ${{ secrets.GITHUB_TOKEN }}
519             auto-fix: true
520             create-pr: true
521              
522             This creates a PR titled "🤖 Optimize GitHub Actions workflows" with all fixes applied.
523              
524             =head2 Mode 3: CI Quality Gate
525              
526             Fail builds if workflow issues are found:
527              
528             # .github/workflows/ghgen-check.yml
529             name: Workflow Quality Check
530              
531             on:
532             pull_request:
533             paths:
534             - '.github/workflows/**'
535              
536             permissions:
537             contents: read
538              
539             jobs:
540             check:
541             runs-on: ubuntu-latest
542             steps:
543             - uses: actions/checkout@v6
544             - uses: nigelhorne/App-GHGen@v1
545             id: check
546             - name: Fail if issues found
547             if: steps.check.outputs.issues-found > 0
548             run: |
549             echo "Found ${{ steps.check.outputs.issues-found }} issues"
550             exit 1
551              
552             =head1 SUPPORTED LANGUAGES
553              
554             =head2 Perl
555              
556             Comprehensive Perl testing with modern best practices.
557              
558             B
559              
560             =over 4
561              
562             =item * Multi-OS testing (Ubuntu, macOS, Windows)
563              
564             =item * Multiple Perl versions (5.22 through 5.40, customizable)
565              
566             =item * Smart version detection from cpanfile, Makefile.PL, dist.ini
567              
568             =item * CPAN module caching with local::lib
569              
570             =item * Perl::Critic integration for code quality
571              
572             =item * Devel::Cover for test coverage
573              
574             =item * Proper environment variables (AUTOMATED_TESTING, NO_NETWORK_TESTING, NONINTERACTIVE_TESTING)
575              
576             =item * Cross-platform compatibility (bash for Unix, cmd for Windows)
577              
578             =back
579              
580             B
581              
582             ghgen generate --type=perl --customize
583              
584             B
585              
586             =over 4
587              
588             =item * actions/checkout@v6
589              
590             =item * actions/cache@v5 for CPAN modules
591              
592             =item * shogo82148/actions-setup-perl@v1
593              
594             =item * Matrix testing across OS and Perl versions
595              
596             =item * Conditional Perl::Critic (latest Perl + Ubuntu only)
597              
598             =item * Conditional coverage (latest Perl + Ubuntu only)
599              
600             =item * Security permissions
601              
602             =item * Concurrency controls
603              
604             =back
605              
606             =head2 Node.js
607              
608             Modern Node.js workflows with npm/yarn/pnpm support.
609              
610             B
611              
612             =over 4
613              
614             =item * Multiple Node.js versions (18.x, 20.x, 22.x)
615              
616             =item * Package manager selection (npm, yarn, pnpm)
617              
618             =item * Dependency caching (~/.npm, ~/.yarn, ~/.pnpm)
619              
620             =item * Optional linting (ESLint)
621              
622             =item * Optional build step
623              
624             =item * Lock file hash-based cache keys
625              
626             =back
627              
628             B
629              
630             =over 4
631              
632             =item * Node.js versions to test
633              
634             =item * Package manager preference
635              
636             =item * Enable/disable linting
637              
638             =item * Enable/disable build step
639              
640             =back
641              
642             =head2 Python
643              
644             Python testing with virtual environment support.
645              
646             B
647              
648             =over 4
649              
650             =item * Multiple Python versions (3.9, 3.10, 3.11, 3.12, 3.13)
651              
652             =item * pip caching (~/.cache/pip)
653              
654             =item * flake8 linting
655              
656             =item * pytest with coverage
657              
658             =item * Optional black formatter checking
659              
660             =item * requirements.txt hash-based cache
661              
662             =back
663              
664             =head2 Rust
665              
666             Rust workflows with cargo, clippy, and formatting.
667              
668             B
669              
670             =over 4
671              
672             =item * Cargo registry and target caching
673              
674             =item * cargo fmt formatting check
675              
676             =item * Clippy linting with -D warnings
677              
678             =item * Comprehensive test suite
679              
680             =item * Optional release builds
681              
682             =item * Cargo.lock hash-based cache
683              
684             =back
685              
686             =head2 Go
687              
688             Go testing with modules and race detection.
689              
690             B
691              
692             =over 4
693              
694             =item * Configurable Go version
695              
696             =item * Go modules caching (~/go/pkg/mod)
697              
698             =item * go vet for static analysis
699              
700             =item * Race detector (-race flag)
701              
702             =item * Test coverage with atomic mode
703              
704             =item * go.sum hash-based cache
705              
706             =back
707              
708             =head2 Ruby
709              
710             Ruby testing with Bundler integration.
711              
712             B
713              
714             =over 4
715              
716             =item * Multiple Ruby versions (3.1, 3.2, 3.3)
717              
718             =item * Automatic Bundler caching (built into setup-ruby)
719              
720             =item * Gemfile.lock hash-based cache
721              
722             =item * Rake integration
723              
724             =back
725              
726             =head2 Docker
727              
728             Docker image building and publishing.
729              
730             B
731              
732             =over 4
733              
734             =item * Docker Buildx for multi-platform builds
735              
736             =item * GitHub Container Registry (GHCR) support
737              
738             =item * Docker Hub support
739              
740             =item * Automatic tag extraction from git
741              
742             =item * Layer caching with GitHub Actions cache
743              
744             =item * Only pushes on non-PR events
745              
746             =back
747              
748             =head2 Static Sites
749              
750             Static site deployment to GitHub Pages.
751              
752             B
753              
754             =over 4
755              
756             =item * GitHub Pages deployment
757              
758             =item * Configurable build command
759              
760             =item * Configurable build directory
761              
762             =item * Artifact upload
763              
764             =item * Proper Pages permissions
765              
766             =item * Separate build and deploy jobs
767              
768             =back
769              
770             =head1 CONFIGURATION DETECTION
771              
772             GHGen automatically detects configuration and adjusts workflows accordingly.
773              
774             =head2 Minimum Version Detection
775              
776             For Perl, minimum version is detected from:
777              
778             =over 4
779              
780             =item * cpanfile: C
781              
782             =item * Makefile.PL: C '5.036'>
783              
784             =item * dist.ini: C
785              
786             =back
787              
788             Only compatible Perl versions are tested (e.g., if min is 5.36, won't test 5.32 or 5.34).
789              
790             =head2 Dependency Files
791              
792             Caching is based on dependency files:
793              
794             =over 4
795              
796             =item * Perl: cpanfile, dist.ini, Makefile.PL, Build.PL
797              
798             =item * Node: package-lock.json, yarn.lock, pnpm-lock.yaml
799              
800             =item * Python: requirements.txt, Pipfile.lock
801              
802             =item * Rust: Cargo.lock
803              
804             =item * Go: go.sum
805              
806             =item * Ruby: Gemfile.lock
807              
808             =back
809              
810             =head1 BEST PRACTICES
811              
812             =head2 Workflow Generation
813              
814             =over 4
815              
816             =item * B - Let GHGen detect your project
817              
818             =item * B - Customize versions, OS, and features
819              
820             =item * B - Always review generated workflows
821              
822             =item * B - Use tools like C to test locally
823              
824             =item * B - Customize only when needed
825              
826             =back
827              
828             =head2 Workflow Analysis
829              
830             =over 4
831              
832             =item * B - Weekly C catches issues early
833              
834             =item * B - Monitor CI costs over time
835              
836             =item * B - Catch issues in PRs automatically
837              
838             =item * B - Always review changes before committing
839              
840             =item * B - Don't fix everything at once if unsure
841              
842             =back
843              
844             =head2 Cost Optimization
845              
846             =over 4
847              
848             =item * B - Biggest time/cost savings
849              
850             =item * B - Cancel superseded runs
851              
852             =item * B - Only run on relevant changes
853              
854             =item * B - Don't test unnecessary combinations
855              
856             =item * B - Only on one OS/version combination
857              
858             =back
859              
860             =head1 EXAMPLES
861              
862             =head2 Example 1: New Perl Module
863              
864             # In your new Perl module directory
865             cd My-Module/
866              
867             # Create cpanfile
868             echo "requires 'perl', '5.036';" > cpanfile
869              
870             # Auto-detect and generate
871             ghgen generate --auto
872              
873             # Review and commit
874             cat .github/workflows/perl-ci.yml
875             git add .github/workflows/perl-ci.yml cpanfile
876             git commit -m "Add CI workflow"
877             git push
878              
879             =head2 Example 2: Optimize Existing Project
880              
881             # Clone project
882             git clone https://github.com/user/project.git
883             cd project/
884              
885             # Analyze with cost estimation
886             ghgen analyze --estimate
887              
888             # Review suggestions, then fix
889             ghgen analyze --fix
890              
891             # Review changes
892             git diff .github/workflows/
893              
894             # Commit improvements
895             git add .github/workflows/
896             git commit -m "Optimize CI: add caching, update actions, add permissions"
897             git push
898              
899             =head2 Example 3: Multi-Language Project
900              
901             # Project with both Node.js and Docker
902             cd fullstack-app/
903              
904             # Generate Node.js workflow
905             ghgen generate --type=node --output=.github/workflows/frontend-ci.yml
906              
907             # Generate Docker workflow
908             ghgen generate --type=docker --output=.github/workflows/backend-build.yml
909              
910             # Analyze both
911             ghgen analyze
912              
913             =head2 Example 4: Custom Perl Testing Matrix
914              
915             # Interactive customization
916             ghgen generate --type=perl --customize
917              
918             # Choose:
919             # Perl versions: 5.36, 5.38, 5.40 (skip older)
920             # OS: Ubuntu, macOS (skip Windows if not needed)
921             # Perl::Critic: Yes
922             # Coverage: Yes
923             # Branches: main
924              
925             =head2 Example 5: CI Quality Gate
926              
927             Add workflow quality checks to your CI:
928              
929             # .github/workflows/ci-quality.yml
930             name: CI Quality Check
931              
932             on:
933             pull_request:
934             paths:
935             - '.github/workflows/**'
936              
937             jobs:
938             check:
939             runs-on: ubuntu-latest
940             steps:
941             - uses: actions/checkout@v6
942             - name: Install GHGen
943             run: cpanm --notest App::GHGen
944             - name: Check workflows
945             run: |
946             if ! ghgen analyze; then
947             echo "::error::Workflow quality issues found"
948             echo "Run 'ghgen analyze --fix' locally to fix"
949             exit 1
950             fi
951              
952             =head1 COMMAND REFERENCE
953              
954             =head2 generate
955              
956             ghgen generate [OPTIONS]
957              
958             Generate a new GitHub Actions workflow.
959              
960             B
961              
962             =over 4
963              
964             =item C<--auto, -a>
965              
966             Auto-detect project type from repository contents.
967              
968             =item C<--type=TYPE, -t TYPE>
969              
970             Specify project type: perl, node, python, rust, go, ruby, docker, static.
971              
972             =item C<--customize, -c>
973              
974             Enable interactive customization mode.
975              
976             =item C<--interactive, -i>
977              
978             Interactively select project type from menu.
979              
980             =item C<--output=FILE, -o FILE>
981              
982             Specify output file (default: .github/workflows/TYPE-ci.yml).
983              
984             =item C<--list, -l>
985              
986             List all available workflow types with descriptions.
987              
988             =back
989              
990             B
991              
992             ghgen generate --auto
993             ghgen generate --type=perl --customize
994             ghgen generate --interactive
995             ghgen generate --type=node --output=custom.yml
996              
997             =head2 analyze
998              
999             ghgen analyze [OPTIONS]
1000              
1001             Analyze existing workflows for issues and optimization opportunities.
1002              
1003             B
1004              
1005             =over 4
1006              
1007             =item C<--fix, -f>
1008              
1009             Automatically apply fixes to detected issues.
1010              
1011             =item C<--estimate, -e>
1012              
1013             Show cost estimates and potential savings.
1014              
1015             =back
1016              
1017             B
1018              
1019             ghgen analyze
1020             ghgen analyze --fix
1021             ghgen analyze --estimate
1022             ghgen analyze --fix --estimate
1023              
1024             =head1 TROUBLESHOOTING
1025              
1026             =head2 Installation Issues
1027              
1028             B C fails to install dependencies
1029              
1030             B
1031              
1032             # Install build tools first
1033             # On Debian/Ubuntu:
1034             sudo apt-get install build-essential
1035              
1036             # On macOS:
1037             xcode-select --install
1038              
1039             # Then retry
1040             cpanm App::GHGen
1041              
1042             =head2 Generation Issues
1043              
1044             B "No .github/workflows directory"
1045              
1046             B
1047              
1048             mkdir -p .github/workflows
1049             ghgen generate --auto
1050              
1051             B Auto-detect doesn't find my project type
1052              
1053             B
1054              
1055             # Specify type explicitly
1056             ghgen generate --type=perl
1057              
1058             # Or ensure indicator files exist
1059             touch cpanfile # for Perl
1060             touch package.json # for Node.js
1061              
1062             =head2 Analysis Issues
1063              
1064             B "Failed to parse YAML"
1065              
1066             B
1067              
1068             # Validate YAML syntax first
1069             yamllint .github/workflows/*.yml
1070              
1071             # Fix YAML errors, then retry
1072             ghgen analyze
1073              
1074             B Cost estimates seem wrong
1075              
1076             B
1077              
1078             Cost estimates are approximations based on:
1079              
1080             =over 4
1081              
1082             =item * Typical commit/PR frequency
1083              
1084             =item * Average workflow duration
1085              
1086             =item * Standard GitHub Actions pricing
1087              
1088             =back
1089              
1090             Actual costs depend on your specific usage patterns.
1091              
1092             =head2 Auto-Fix Issues
1093              
1094             B Auto-fix didn't fix everything
1095              
1096             B
1097              
1098             Some issues can't be auto-fixed:
1099              
1100             =over 4
1101              
1102             =item * Complex workflow logic
1103              
1104             =item * Custom actions
1105              
1106             =item * Project-specific configurations
1107              
1108             =back
1109              
1110             Review the remaining suggestions and apply manually.
1111              
1112             =head2 GitHub Action Issues
1113              
1114             B "Permission denied" errors
1115              
1116             B
1117              
1118             # Ensure correct permissions in workflow
1119             permissions:
1120             contents: write # For auto-fix
1121             pull-requests: write # For comments
1122              
1123             B Action not triggering
1124              
1125             B
1126              
1127             # For scheduled workflows, ensure:
1128             on:
1129             schedule:
1130             - cron: '0 9 * * 1'
1131             workflow_dispatch: # Allows manual trigger
1132              
1133             # Test with manual trigger first
1134              
1135             =head1 DEPENDENCIES
1136              
1137             =head2 Runtime Dependencies
1138              
1139             =over 4
1140              
1141             =item * Perl 5.36 or higher
1142              
1143             =item * L - Fast YAML parsing and generation
1144              
1145             =item * L - File and directory operations
1146              
1147             =item * L - Colored terminal output
1148              
1149             =item * L - Command-line option parsing
1150              
1151             =back
1152              
1153             =head2 Test Dependencies
1154              
1155             =over 4
1156              
1157             =item * L - Testing framework
1158              
1159             =item * L - Exception testing
1160              
1161             =back
1162              
1163             =head2 Optional Dependencies
1164              
1165             =over 4
1166              
1167             =item * L - For generating README from POD
1168              
1169             =back
1170              
1171             =head1 SEE ALSO
1172              
1173             =over 4
1174              
1175             =item * L
1176              
1177             =item * L
1178              
1179             =back
1180              
1181             =head2 GitHub Actions Documentation
1182              
1183             =over 4
1184              
1185             =item * L
1186              
1187             =item * L
1188              
1189             =item * L
1190              
1191             =item * L
1192              
1193             =back
1194              
1195             =head2 Related Tools
1196              
1197             =over 4
1198              
1199             =item * L - Run GitHub Actions locally
1200              
1201             =item * L - Linter for GitHub Actions
1202              
1203             =item * L - YAML linter
1204              
1205             =back
1206              
1207             =head1 REPOSITORY
1208              
1209             L
1210              
1211             =head1 CONTRIBUTING
1212              
1213             Contributions are welcome! GHGen is open source and hosted on GitHub.
1214              
1215             =head2 Ways to Contribute
1216              
1217             =over 4
1218              
1219             =item * B - L
1220              
1221             =item * B - Open an issue with your idea
1222              
1223             =item * B - Contribute new workflow templates
1224              
1225             =item * B - Fix typos, add examples
1226              
1227             =item * B - Code contributions
1228              
1229             =back
1230              
1231             =head2 Development Setup
1232              
1233             # Fork and clone
1234             git clone https://github.com/nigelhorne/ghgen.git
1235             cd ghgen
1236              
1237             # Install dependencies
1238             cpanm --installdeps .
1239              
1240             # Run tests
1241             prove -lr t/
1242              
1243             # Make changes
1244             # ... edit files ...
1245              
1246             # Test your changes
1247             perl -Ilib bin/ghgen generate --type=perl
1248             prove -lr t/
1249              
1250             # Commit and push
1251             git add .
1252             git commit -m "Description of changes"
1253             git push origin your-branch
1254              
1255             # Open pull request on GitHub
1256              
1257             =head2 Adding a New Language
1258              
1259             To add support for a new language:
1260              
1261             1. Create generator function in C
1262              
1263             2. Add detection logic in C
1264              
1265             3. Add customization in C
1266              
1267             4. Add tests in C
1268              
1269             5. Update documentation
1270              
1271             =head1 SUPPORT
1272              
1273             This module is provided as-is without any warranty.
1274              
1275             Please report any bugs or feature requests to C,
1276             or through the web interface at
1277             L.
1278             I will be notified, and then you'll
1279             automatically be notified of progress on your bug as I make changes.
1280              
1281             You can find documentation for this module with the perldoc command.
1282              
1283             perldoc App::GHGen
1284              
1285             You can also look for information at:
1286              
1287             =head2 Getting Help
1288              
1289             =over 4
1290              
1291             =item * L - Bug reports and feature requests
1292              
1293             =item * L - Questions and community
1294              
1295             =item * Email: L
1296              
1297             =back
1298              
1299             =head2 Commercial Support
1300              
1301             For commercial support, consulting, or custom development, contact the author.
1302              
1303             =head1 AUTHOR
1304              
1305             Nigel Horne Enjh@nigelhorne.comE
1306              
1307             L
1308              
1309             =head1 CONTRIBUTORS
1310              
1311             Thanks to all contributors who have helped improve GHGen!
1312              
1313             See L
1314              
1315             =head1 COPYRIGHT AND LICENSE
1316              
1317             Copyright 2025-2026 Nigel Horne.
1318              
1319             Usage is subject to license terms.
1320              
1321             The license terms of this software are as follows:
1322              
1323             =cut
1324              
1325             1;