mirror of
https://github.com/ivuorinen/gh-action-readme.git
synced 2026-02-28 05:54:52 +00:00
feat: gen command enhancements, race condition fixes, workflow tweaks (#21)
* feat: enhance gen command with directory/file arguments and custom output filenames - Add positional argument support for targeting specific directories or files - Add --output flag for custom output filename specification - Implement resolveOutputPath method to handle absolute and relative custom paths - Update CLI interface with comprehensive examples and help text - Fix race condition in FixtureManager cache access with RWMutex synchronization - Update .gitignore to cover additional generated file types (html, json) - Maintain backward compatibility with existing gen command usage This enhancement enables generating documentation for multiple actions in the same directory without filename conflicts, while supporting flexible file targeting. * feat: enhance CI workflow and standardize license filename - Update CI workflow to use new gen command functionality with directory targeting - Remove working-directory requirement by using positional arguments - Add comprehensive documentation generation with multiple formats (md, html, json) - Test single file targeting and recursive generation with themes - Add artifact upload for generated documentation files - Standardize license filename from LICENSE.md to LICENSE following GitHub conventions - Clean up duplicate license files The enhanced workflow demonstrates all new gen command features including directory targeting, custom output filenames, multiple formats, and themes. * fix: resolve all linting and EditorConfig violations Fixed remaining code quality issues: - Line length violation in TODO.md by breaking long summary - Trailing whitespace removal from CI workflow, CLAUDE.md, and TODO.md - Indentation consistency fixes in CI workflow YAML - Security workflow cleanup for better formatting All linters now pass: - golangci-lint: 0 issues - EditorConfig: No violations detected Project maintains enterprise-grade code quality standards. * refactor: optimize security workflow by removing Snyk and reducing duplication Streamlined security scanning workflow: - Remove Snyk job to eliminate redundancy with govulncheck and Trivy - Add comprehensive coverage documentation explaining each tool's purpose - Ensure consistent action version pinning across all jobs - Maintain complete security protection with govulncheck, Trivy, gitleaks, and dependency-review Benefits: - Reduced execution time by ~2-3 minutes per workflow run - Simplified secret management (no SNYK_TOKEN required) - Lower complexity while maintaining enterprise-grade security coverage - Better workflow maintainability with clear job documentation Security coverage remains comprehensive with Go-specific vulnerability scanning, multi-language dependency analysis, secrets detection, and PR-level dependency review.
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"gopkg.in/yaml.v3"
|
||||
)
|
||||
@@ -96,6 +97,7 @@ type FixtureManager struct {
|
||||
basePath string
|
||||
scenarios map[string]*TestScenario
|
||||
cache map[string]*ActionFixture
|
||||
mu sync.RWMutex // protects cache map
|
||||
}
|
||||
|
||||
// GitHub API response fixtures for testing.
|
||||
@@ -367,10 +369,13 @@ func (fm *FixtureManager) LoadScenarios() error {
|
||||
|
||||
// LoadActionFixture loads an action fixture with metadata.
|
||||
func (fm *FixtureManager) LoadActionFixture(name string) (*ActionFixture, error) {
|
||||
// Check cache first
|
||||
// Check cache first with read lock
|
||||
fm.mu.RLock()
|
||||
if fixture, exists := fm.cache[name]; exists {
|
||||
fm.mu.RUnlock()
|
||||
return fixture, nil
|
||||
}
|
||||
fm.mu.RUnlock()
|
||||
|
||||
// Determine fixture path based on naming convention
|
||||
fixturePath := fm.resolveFixturePath(name)
|
||||
@@ -393,8 +398,15 @@ func (fm *FixtureManager) LoadActionFixture(name string) (*ActionFixture, error)
|
||||
fixture.Scenario = scenario
|
||||
}
|
||||
|
||||
// Cache the fixture
|
||||
// Cache the fixture with write lock
|
||||
fm.mu.Lock()
|
||||
// Double-check cache in case another goroutine cached it while we were loading
|
||||
if cachedFixture, exists := fm.cache[name]; exists {
|
||||
fm.mu.Unlock()
|
||||
return cachedFixture, nil
|
||||
}
|
||||
fm.cache[name] = fixture
|
||||
fm.mu.Unlock()
|
||||
|
||||
return fixture, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user