mirror of
https://github.com/ivuorinen/gh-action-readme.git
synced 2026-02-10 14:48:05 +00:00
* feat: detect permissions from actions * refactor(test): fix 25 SonarCloud issues by extracting test constants Resolved all SonarCloud code quality issues for PR #137: - Fixed 12 string duplication issues (S1192) - Fixed 13 naming convention issues (S100) Changes: - Centralized test constants in appconstants/test_constants.go * Added 9 parser test constants for YAML templates * Added 3 template test constants for paths and versions - Updated parser_test.go to use shared constants - Updated template_test.go to use shared constants - Renamed 13 test functions to camelCase (removed underscores) * chore: reduce code duplication * fix: implement cr fixes * chore: deduplication
113 lines
2.2 KiB
Cheetah
113 lines
2.2 KiB
Cheetah
# {{.Name}}
|
|
|
|
{{if .Branding}}**{{.Branding.Icon}}** {{end}}**{{.Description}}**
|
|
|
|
---
|
|
|
|
## Installation
|
|
|
|
Add this action to your GitLab CI/CD pipeline or GitHub workflow:
|
|
|
|
### GitHub Actions
|
|
|
|
```yaml
|
|
steps:
|
|
- name: {{.Name}}
|
|
uses: {{gitUsesString .}}
|
|
{{if .Inputs}}with:
|
|
{{- range $key, $val := .Inputs}}
|
|
{{$key}}: {{if $val.Default}}{{$val.Default}}{{else}}value{{end}}
|
|
{{- end}}{{end}}
|
|
```
|
|
|
|
### GitLab CI/CD
|
|
|
|
```yaml
|
|
{{.Name | lower | replace " " "-"}}:
|
|
stage: build
|
|
image: node:20
|
|
script:
|
|
- # Your action logic here
|
|
{{if .Inputs}}variables:
|
|
{{- range $key, $val := .Inputs}}
|
|
{{$key | upper}}: {{if $val.Default}}{{$val.Default}}{{else}}value{{end}}
|
|
{{- end}}{{end}}
|
|
```
|
|
|
|
## Configuration
|
|
|
|
{{if .Inputs}}
|
|
### Input Parameters
|
|
|
|
{{range $key, $input := .Inputs}}
|
|
#### `{{$key}}`
|
|
- **Description**: {{$input.Description}}
|
|
- **Type**: String{{if $input.Required}}
|
|
- **Required**: Yes{{else}}
|
|
- **Required**: No{{end}}{{if $input.Default}}
|
|
- **Default**: `{{$input.Default}}`{{end}}
|
|
|
|
{{end}}
|
|
{{end}}
|
|
|
|
{{if .Outputs}}
|
|
### Output Parameters
|
|
|
|
{{range $key, $output := .Outputs}}
|
|
#### `{{$key}}`
|
|
- **Description**: {{$output.Description}}
|
|
|
|
{{end}}
|
|
{{end}}
|
|
|
|
{{if and .Permissions (gt (len .Permissions) 0)}}
|
|
### Required Permissions
|
|
|
|
{{range $key, $value := .Permissions}}
|
|
#### `{{$key}}`
|
|
- **Access Level**: `{{$value}}`
|
|
|
|
{{end}}
|
|
|
|
**GitHub Actions Workflow:**
|
|
```yaml
|
|
permissions:
|
|
{{- range $key, $value := .Permissions}}
|
|
{{$key}}: {{$value}}
|
|
{{- end}}
|
|
```
|
|
{{end}}
|
|
|
|
## Usage Examples
|
|
|
|
### Basic Example
|
|
|
|
```yaml
|
|
{{.Name | lower | replace " " "-"}}:
|
|
stage: deploy
|
|
script:
|
|
- echo "Using {{.Name}}"
|
|
{{if .Inputs}}variables:
|
|
{{- range $key, $val := .Inputs}}
|
|
{{$key | upper}}: "{{if $val.Default}}{{$val.Default}}{{else}}example{{end}}"
|
|
{{- end}}{{end}}
|
|
```
|
|
|
|
### Advanced Example
|
|
|
|
For more complex scenarios, refer to the [action.yml](./action.yml) specification.
|
|
|
|
## Documentation
|
|
|
|
- [Action specification](./action.yml)
|
|
- [Usage examples](./examples/)
|
|
- [Contributing guidelines](./CONTRIBUTING.md)
|
|
|
|
## License
|
|
|
|
This project is licensed under the MIT License.
|
|
|
|
---
|
|
|
|
*Generated with [gh-action-readme](https://github.com/ivuorinen/gh-action-readme)*
|