Files
gh-action-readme/templates_embed/templates/themes/gitlab/readme.tmpl
Ismo Vuorinen ce23f93b74 feat: detect permissions from actions (#137)
* 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
2026-01-04 02:48:29 +02:00

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)*