mirror of
https://github.com/ivuorinen/gh-action-readme.git
synced 2026-02-15 08:49:51 +00:00
This commit represents a comprehensive refactoring of the codebase focused on improving code quality, testability, and maintainability. Key improvements: - Implement dependency injection and interface-based architecture - Add comprehensive test framework with fixtures and test suites - Fix all linting issues (errcheck, gosec, staticcheck, goconst, etc.) - Achieve full EditorConfig compliance across all files - Replace hardcoded test data with proper fixture files - Add configuration loader with hierarchical config support - Improve error handling with contextual information - Add progress indicators for better user feedback - Enhance Makefile with help system and improved editorconfig commands - Consolidate constants and remove deprecated code - Strengthen validation logic for GitHub Actions - Add focused consumer interfaces for better separation of concerns Testing improvements: - Add comprehensive integration tests - Implement test executor pattern for better test organization - Create extensive YAML fixture library for testing - Fix all failing tests and improve test coverage - Add validation test fixtures to avoid embedded YAML in Go files Build and tooling: - Update Makefile to show help by default - Fix editorconfig commands to use eclint properly - Add comprehensive help documentation to all make targets - Improve file selection patterns to avoid glob errors This refactoring maintains backward compatibility while significantly improving the internal architecture and developer experience.
= {{.Name}}
:toc: left
:toclevels: 3
:icons: font
:source-highlighter: highlight.js
{{if .Branding}}image:https://img.shields.io/badge/icon-{{.Branding.Icon}}-{{.Branding.Color}}[{{.Branding.Icon}}] {{end}}+
image:https://img.shields.io/badge/GitHub%20Action-{{.Name | replace " " "%20"}}-blue[GitHub Action] +
image:https://img.shields.io/badge/license-MIT-green[License]
[.lead]
{{.Description}}
== Quick Start
Add this action to your GitHub workflow:
[source,yaml]
----
name: CI Workflow
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: {{.Name}}
uses: your-org/{{.Name | lower | replace " " "-"}}@v1
{{if .Inputs}}with:
{{- range $key, $val := .Inputs}}
{{$key}}: {{if $val.Default}}"{{$val.Default}}"{{else}}"value"{{end}}
{{- end}}{{end}}
----
{{if .Inputs}}
== Input Parameters
[cols="1,3,1,2", options="header"]
|===
| Parameter | Description | Required | Default
{{range $key, $input := .Inputs}}
| `{{$key}}`
| {{$input.Description}}
| {{if $input.Required}}✓{{else}}✗{{end}}
| {{if $input.Default}}`{{$input.Default}}`{{else}}_none_{{end}}
{{end}}
|===
=== Parameter Details
{{range $key, $input := .Inputs}}
==== {{$key}}
{{$input.Description}}
[horizontal]
Type:: String
Required:: {{if $input.Required}}Yes{{else}}No{{end}}
{{if $input.Default}}Default:: `{{$input.Default}}`{{end}}
.Example
[source,yaml]
----
with:
{{$key}}: {{if $input.Default}}"{{$input.Default}}"{{else}}"your-value"{{end}}
----
{{end}}
{{end}}
{{if .Outputs}}
== Output Parameters
[cols="1,3", options="header"]
|===
| Parameter | Description
{{range $key, $output := .Outputs}}
| `{{$key}}`
| {{$output.Description}}
{{end}}
|===
=== Using Outputs
[source,yaml]
----
- name: {{.Name}}
id: action-step
uses: your-org/{{.Name | lower | replace " " "-"}}@v1
- name: Use Output
run: |
{{- range $key, $output := .Outputs}}
echo "{{$key}}: \${{"{{"}} steps.action-step.outputs.{{$key}} {{"}}"}}"
{{- end}}
----
{{end}}
== Examples
=== Basic Usage
[source,yaml]
----
- name: Basic {{.Name}}
uses: your-org/{{.Name | lower | replace " " "-"}}@v1
{{if .Inputs}}with:
{{- range $key, $val := .Inputs}}
{{$key}}: {{if $val.Default}}"{{$val.Default}}"{{else}}"example-value"{{end}}
{{- end}}{{end}}
----
=== Advanced Configuration
[source,yaml]
----
- name: Advanced {{.Name}}
uses: your-org/{{.Name | lower | replace " " "-"}}@v1
{{if .Inputs}}with:
{{- range $key, $val := .Inputs}}
{{$key}}: {{if $val.Default}}"{{$val.Default}}"{{else}}"\${{"{{"}} vars.{{$key | upper}} {{"}}"}}"{{end}}
{{- end}}{{end}}
env:
GITHUB_TOKEN: \${{"{{"}} secrets.GITHUB_TOKEN {{"}}"}}
----
=== Conditional Usage
[source,yaml]
----
- name: Conditional {{.Name}}
if: github.event_name == 'push'
uses: your-org/{{.Name | lower | replace " " "-"}}@v1
{{if .Inputs}}with:
{{- range $key, $val := .Inputs}}
{{$key}}: {{if $val.Default}}"{{$val.Default}}"{{else}}"production-value"{{end}}
{{- end}}{{end}}
----
== Troubleshooting
[TIP]
====
Common issues and solutions:
1. **Authentication Errors**: Ensure required secrets are configured
2. **Permission Issues**: Verify GitHub token permissions
3. **Configuration Errors**: Validate input parameters
====
== Development
For development information, see the link:./action.yml[action.yml] specification.
=== Contributing
Contributions are welcome! Please:
1. Fork the repository
2. Create a feature branch
3. Make your changes
4. Add tests
5. Submit a pull request
== License
This project is licensed under the MIT License.
---
_Documentation generated with https://github.com/ivuorinen/gh-action-readme[gh-action-readme]_