Files
gh-action-readme/templates_embed/templates/themes/professional
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
..

# {{.Name}}

{{if .Branding}}
<div align="center">
  <img src="https://img.shields.io/badge/icon-{{.Branding.Icon}}-{{.Branding.Color}}" alt="{{.Branding.Icon}}" />
  <img src="https://img.shields.io/badge/status-stable-brightgreen" alt="Status" />
  <img src="https://img.shields.io/badge/license-MIT-blue" alt="License" />
</div>
{{end}}

## Overview

{{.Description}}

This GitHub Action provides a robust solution for your CI/CD pipeline with comprehensive configuration options and detailed output information.

## Table of Contents

- [Quick Start](#quick-start)
- [Configuration](#configuration)
{{if .Inputs}}- [Input Parameters](#input-parameters){{end}}
{{if .Outputs}}- [Output Parameters](#output-parameters){{end}}
- [Examples](#examples)
{{if .Dependencies}}- [Dependencies](#-dependencies){{end}}
- [Troubleshooting](#troubleshooting)
- [Contributing](#contributing)
- [License](#license)

## Quick Start

Add the following step to your GitHub Actions workflow:

```yaml
name: CI/CD Pipeline
on:
  push:
    branches: [ main, develop ]
  pull_request:
    branches: [ main ]

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout Repository
        uses: actions/checkout@v4

      - name: {{.Name}}
        uses: {{gitUsesString .}}
        {{if .Inputs}}with:
        {{- range $key, $val := .Inputs}}
          {{$key}}: {{if $val.Default}}"{{$val.Default}}"{{else}}"your-value-here"{{end}}
        {{- end}}{{end}}
```

## Configuration

This action supports various configuration options to customize its behavior according to your needs.

{{if .Inputs}}
### Input Parameters

| Parameter | Description | Type | Required | Default Value |
|-----------|-------------|------|----------|---------------|
{{- range $key, $input := .Inputs}}
| **`{{$key}}`** | {{$input.Description}} | `string` | {{if $input.Required}}✅ Yes{{else}}❌ No{{end}} | {{if $input.Default}}`{{$input.Default}}`{{else}}_None_{{end}} |
{{- end}}

#### Parameter Details

{{range $key, $input := .Inputs}}
##### `{{$key}}`

{{$input.Description}}

- **Type**: String
- **Required**: {{if $input.Required}}Yes{{else}}No{{end}}{{if $input.Default}}
- **Default**: `{{$input.Default}}`{{end}}

```yaml
with:
  {{$key}}: {{if $input.Default}}"{{$input.Default}}"{{else}}"your-value-here"{{end}}
```

{{end}}
{{end}}

{{if .Outputs}}
### Output Parameters

This action provides the following outputs that can be used in subsequent workflow steps:

| Parameter | Description | Usage |
|-----------|-------------|-------|
{{- range $key, $output := .Outputs}}
| **`{{$key}}`** | {{$output.Description}} | `\${{"{{"}} steps.{{$.Name | lower | replace " " "-"}}.outputs.{{$key}} {{"}}"}}` |
{{- end}}

#### Using Outputs

```yaml
- name: {{.Name}}
  id: action-step
  uses: {{gitUsesString .}}

- name: Use Output
  run: |
  {{- range $key, $output := .Outputs}}
    echo "{{$key}}: \${{"{{"}} steps.action-step.outputs.{{$key}} {{"}}"}}"
  {{- end}}
```
{{end}}

{{if .Permissions}}
## 🔐 Required Permissions

This action requires specific GitHub permissions to function correctly. Ensure your workflow includes these permissions:

| Permission | Access Level | Description |
|------------|--------------|-------------|
{{- range $key, $value := .Permissions}}
| `{{$key}}` | `{{$value}}` | Required for action operation |
{{- end}}

### How to Set Permissions

```yaml
name: My Workflow
on: [push]

permissions:
{{- range $key, $value := .Permissions}}
  {{$key}}: {{$value}}
{{- end}}

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: {{gitUsesString .}}
```

**Note:** If your workflow doesn't specify permissions, GitHub uses default permissions which may not include all required permissions above.
{{end}}

## Examples

### Basic Usage

```yaml
- name: Basic {{.Name}}
  uses: {{gitUsesString .}}
  {{if .Inputs}}with:
  {{- range $key, $val := .Inputs}}
    {{$key}}: {{if $val.Default}}"{{$val.Default}}"{{else}}"example-value"{{end}}
  {{- end}}{{end}}
```

### Advanced Configuration

```yaml
- name: Advanced {{.Name}}
  uses: {{gitUsesString .}}
  {{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

```yaml
- name: Conditional {{.Name}}
  if: github.event_name == 'push'
  uses: {{gitUsesString .}}
  {{if .Inputs}}with:
  {{- range $key, $val := .Inputs}}
    {{$key}}: {{if $val.Default}}"{{$val.Default}}"{{else}}"production-value"{{end}}
  {{- end}}{{end}}
```

{{if .Dependencies}}
## 📦 Dependencies

This action uses the following dependencies:

| Action | Version | Author | Description |
|--------|---------|--------|-------------|
{{- range .Dependencies}}
| {{if .MarketplaceURL}}[{{.Name}}]({{.MarketplaceURL}}){{else}}{{.Name}}{{end}} | {{if .IsPinned}}🔒{{end}}{{.Version}} | [{{.Author}}](https://github.com/{{.Author}}) | {{.Description}} |
{{- end}}

<details>
<summary>📋 Dependency Details</summary>

{{range .Dependencies}}
### {{.Name}}{{if .Version}} @ {{.Version}}{{end}}

{{if .IsPinned}}
- 🔒 **Pinned Version**: Locked to specific version for security
{{else}}
- 📌 **Floating Version**: Using latest version (consider pinning for security)
{{end}}
- 👤 **Author**: [{{.Author}}](https://github.com/{{.Author}})
{{if .MarketplaceURL}}- 🏪 **Marketplace**: [View on GitHub Marketplace]({{.MarketplaceURL}}){{end}}
{{if .SourceURL}}- 📂 **Source**: [View Source]({{.SourceURL}}){{end}}
{{if .WithParams}}
- **Configuration**:
  ```yaml
  with:
  {{- range $key, $value := .WithParams}}
    {{$key}}: {{$value}}
  {{- end}}
  ```
{{end}}

{{end}}

{{$hasLocalDeps := false}}
{{range .Dependencies}}{{if .IsLocalAction}}{{$hasLocalDeps = true}}{{end}}{{end}}
{{if $hasLocalDeps}}
### Same Repository Dependencies
{{range .Dependencies}}{{if .IsLocalAction}}
- [{{.Name}}]({{.SourceURL}}) - {{.Description}}
{{end}}{{end}}
{{end}}

</details>
{{end}}

## Troubleshooting

### Common Issues

1. **Authentication Errors**: Ensure you have set up the required secrets in your repository settings.
2. **Permission Issues**: Check that your GitHub token has the necessary permissions.
3. **Configuration Errors**: Validate your input parameters against the schema.

### Getting Help

- Check the [action.yml](./action.yml) for the complete specification
- Review the [examples](./examples/) directory for more use cases
- Open an issue if you encounter problems

## Contributing

We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.

### Development Setup

1. Fork this repository
2. Create a feature branch
3. Make your changes
4. Add tests if applicable
5. Submit a pull request

## License

This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.

## Support

If you find this action helpful, please consider:

- ⭐ Starring this repository
- 🐛 Reporting issues
- 💡 Suggesting improvements
- 🤝 Contributing code

---

<div align="center">
  <sub>📚 Documentation generated with <a href="https://github.com/ivuorinen/gh-action-readme">gh-action-readme</a></sub>
</div>