From 05e3af85d747075bb94cf2d928c4d333c8bbf62e Mon Sep 17 00:00:00 2001 From: Mandresy RABENJAHARISON Date: Wed, 20 Aug 2025 14:31:03 +0300 Subject: [PATCH] fix: update README and action.yml to standardize environment variable names and improve clarity --- README.md | 42 ++++++++++++++---------------------------- action.yml | 29 +++++++---------------------- 2 files changed, 21 insertions(+), 50 deletions(-) diff --git a/README.md b/README.md index 9556021..f60ed65 100644 --- a/README.md +++ b/README.md @@ -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 ``` -/us- +/ticket- ``` * `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! diff --git a/action.yml b/action.yml index 9362bc6..1788967 100644 --- a/action.yml +++ b/action.yml @@ -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 " 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 }} \ No newline at end of file + REPO_OWNER: ${{ gitea.event.repository.owner.login }} + REPO_NAME: ${{ gitea.event.repository.name }} \ No newline at end of file