Files
format-stack-name/README.md
Radosław Kukuczka b8558780be update readme
2025-03-30 13:35:37 +02:00

97 lines
2.8 KiB
Markdown

# 🛠️ Format Stack Name Action
This GitHub Action formats your repository name into a clean, consistent stack name that's perfect for deployments. 🚀
---
## 🤔 Why Use This Action?
When deploying stacks or services, it's crucial to have clean, consistent, and predictable naming conventions. This action takes your GitHub repository name (`org/repo`) and formats it into a standardized stack name, ensuring compatibility and readability in Docker, Kubernetes, or any other deployment system.
---
## ⚙️ How It Works
Given a repository name like:
```
my-org.cool/repo-name_example
```
This action will produce:
| Output | Example Result |
|------------------|--------------------------------|
| `name` | `my-org-cool__repo-name_example` |
| `org` | `my-org-cool` |
| `repo` | `repo-name_example` |
**Formatting rules:**
- Organization (`org`):
- Replaces dots (`.`) with dashes (`-`)
- Replaces any invalid characters with underscores (`_`)
- Repository (`repo`):
- Replaces any invalid characters with underscores (`_`)
The final stack name combines the formatted organization and repository names with double underscores (`__`).
---
## 🚦 Inputs & Outputs
### 📥 Inputs
This action doesn't require any inputs. It automatically uses the current repository context.
### 📤 Outputs
| Output | Description | Example |
|--------|-------------------------------------|------------------------------|
| `name` | Formatted stack name | `my-org__my-repo` |
| `org` | Formatted organization name | `my-org` |
| `repo` | Formatted repository name | `my-repo` |
---
## 🚀 Example Usage
Here's how you can easily integrate this action into your workflow:
```yaml
- name: Format Stack Name 🛠️
id: stack-format
uses: your-org/format-stack-name@main
- name: Print Formatted Stack Name 📢
run: |
echo "Formatted Stack Name: ${{ steps.stack-format.outputs.name }}"
echo "Formatted Org Name: ${{ steps.stack-format.outputs.org }}"
echo "Formatted Repo Name: ${{ steps.stack-format.outputs.repo }}"
```
---
## 🐞 Debugging
This action provides debug logs to help you understand what's happening under the hood:
```
Debug: FULL_REPO=my-org.cool/repo-name_example
Debug: ORG=my-org.cool, REPO=repo-name_example
Debug: FORMATTED_ORG=my-org-cool, FORMATTED_REPO=repo-name_example
Debug: STACK_NAME=my-org-cool__repo-name_example
```
---
## 🙋‍♂️ Need Help?
If you encounter any issues or have suggestions, please open an issue or reach out directly. Let's make deployments smoother together!
---
Happy deploying! 🚀
— **Grand**