fix: update README and action.yml to standardize environment variable names and improve clarity

This commit is contained in:
Mandresy RABENJAHARISON 2025-08-20 14:31:03 +03:00
parent cfc3735a7d
commit 05e3af85d7
2 changed files with 21 additions and 50 deletions

View File

@ -16,16 +16,13 @@
## Environment variables
Only the following environment variables need to be set manually:
| Variable name | Required | Example value | Purpose |
|---------------|-----------|------------------------------|------------------------------------------------|
| `GITEA_URL` | * | `https://git.example.com` | Base URL of the Gitea instance |
| `GITEA_TOKEN` | * | `ghp_xxx…` | Personal access token with **repo** scope |
| `REPO_OWNER` | * | `acme` | Repository owner (user or org) |
| `REPO_NAME` | * | `widgets` | Repository name |
| `ISSUE_NUMBER`| * | `42` | Issue number to work from |
| `ISSUE_TITLE` | * | `Add Dark Mode` | Issue title (used for logging only) |
| `ISSUE_LABELS`| | `bug, ui` | Comma-separated list of labels |
| `BASE_REF` | | `main` | Base branch/commit SHA (default **develop**) |
| `GITEA_URL` | * | `https://gitea.example.com` | Base URL of the Gitea instance |
| `GITEA_TOKEN` | * | `xxxx…` | Personal access token with **repo** scope |
> **Label → prefix mapping**
@ -40,18 +37,14 @@
## Quick start (Gitea Actions)
Exactly the same YAML—`act_runner` builds the Dockerfile automatically:
Example workflow YAML—`act_runner` builds the Dockerfile automatically:
```yaml
- uses: mandresyrabenja/gitea-issue-branch@v1
env:
GITEA_URL: https://git.example.com
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
REPO_OWNER: acme
REPO_NAME: widgets
ISSUE_NUMBER: ${{ gitea.event.issue.number }}
ISSUE_TITLE: ${{ gitea.event.issue.title }}
ISSUE_LABELS: ${{ join(gitea.event.issue.labels.*.name, ',') }}
- uses: gitea.ethumada.com/gitea/new-issue-create-branch@v1
env:
GITEA_URL: https://git.example.com
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
```
---
@ -59,11 +52,11 @@ Exactly the same YAML—`act_runner` builds the Dockerfile automatically:
## Branch-naming rules
```
<prefix>/us-<ISSUE_NUMBER>
<prefix>/ticket-<ISSUE_NUMBER>
```
* `prefix` = **feature**, **bugfix**, or **hotfix** (based on label table above)
* Example: `feature/us-123`, `hotfix/us-7`
* Example: `feature/ticket-123`, `hotfix/ticket-7`
---
@ -73,13 +66,8 @@ Exactly the same YAML—`act_runner` builds the Dockerfile automatically:
# build and run the container locally
docker build -t gitea-issue-branch-action .
docker run --rm \
-e GITEA_URL=https://git.example.com \
-e GITEA_URL=https://gitea.example.com \
-e GITEA_TOKEN=xxx \
-e REPO_OWNER=acme \
-e REPO_NAME=widgets \
-e ISSUE_NUMBER=42 \
-e ISSUE_TITLE="Example" \
-e ISSUE_LABELS="enhancement" \
gitea-issue-branch-action
```
@ -90,5 +78,3 @@ Or use [`act`](https://github.com/nektos/act) to execute the full workflow.
## 📄 License
Distributed under the MIT License—see [`LICENSE`](./LICENSE) for details.
Feel free to open issues or pull requests to enhance the action!

View File

@ -1,41 +1,26 @@
name: "Create branch in Gitea"
description: "Creates a git branch from an issue and links it back."
name: "new-issue-create-branch"
description: "Creates a git branch from an issue and links it back to the issue."
author: "Mandresy RABENJAHARISON <mandresyrabenj@gmail.com>"
branding:
icon: git-branch
color: purple
inputs:
issue_labels:
description: "Issue Labels."
required: true
issue_number:
description: "Issue Number."
required: true
issue_title:
description: "Issue Title."
required: true
gitea_token:
description: "Gitea Access Token."
required: true
gitea_url:
description: "Gitea Instance URL."
required: true
repo_owner:
description: "Git Repository Owner."
required: true
repo_name:
description: "Repository Name."
required: true
runs:
using: "docker"
image: "Dockerfile"
env:
ISSUE_LABELS: ${{ inputs.issue_labels }}
ISSUE_NUMBER: ${{ inputs.issue_number }}
ISSUE_TITLE: ${{ inputs.issue_title }}
ISSUE_LABELS: ${{ gitea.event.issue.labels }}
ISSUE_NUMBER: ${{ gitea.event.issue.number }}
ISSUE_TITLE: ${{ gitea.event.issue.title }}
GITEA_TOKEN: ${{ inputs.gitea_token }}
GITEA_URL: ${{ inputs.gitea_url }}
REPO_OWNER: ${{ inputs.repo_owner }}
REPO_NAME: ${{ inputs.repo_name }}
REPO_OWNER: ${{ gitea.event.repository.owner.login }}
REPO_NAME: ${{ gitea.event.repository.name }}