Forgejo/options/locale
Mai-Lapyst 51735c415b Add support for workflow_dispatch (#3334)
Closes #2797

I'm aware of https://github.com/go-gitea/gitea/pull/28163 exists, but since I had it laying around on my drive and collecting dust, I might as well open a PR for it if anyone wants the feature a bit sooner than waiting for upstream to release it or to be a forgejo "native" implementation.

This PR Contains:
- Support for the `workflow_dispatch` trigger
- Inputs: boolean, string, number, choice

Things still to be done:
- [x] API Endpoint `/api/v1/<org>/<repo>/actions/workflows/<workflow id>/dispatches`
- ~~Fixing some UI bugs I had no time figuring out, like why dropdown/choice inputs's menu's behave weirdly~~ Unrelated visual bug with dropdowns inside dropdowns
- [x] Fix bug where opening the branch selection submits the form
- [x] Limit on inputs to render/process

Things not in this PR:
- Inputs: environment (First need support for environments in forgejo)

Things needed to test this:
- A patch for https://code.forgejo.org/forgejo/runner to actually consider the inputs inside the workflow.
  ~~One possible patch can be seen here: https://code.forgejo.org/Mai-Lapyst/runner/src/branch/support-workflow-inputs~~
  [PR](https://code.forgejo.org/forgejo/runner/pulls/199)

![image](/attachments/2db50c9e-898f-41cb-b698-43edeefd2573)

## Testing

- Checkout PR
- Setup new development runner with [this PR](https://code.forgejo.org/forgejo/runner/pulls/199)
- Create a repo with a workflow (see below)
- Go to the actions tab, select the workflow and see the notice as in the screenshot above
- Use the button + dropdown to run the workflow
  - Try also running it via the api using the `` endpoint
- ...
- Profit!

<details>
<summary>Example workflow</summary>

```yaml
on:
  workflow_dispatch:
    inputs:
      logLevel:
        description: 'Log Level'
        required: true
        default: 'warning'
        type: choice
        options:
        - info
        - warning
        - debug
      tags:
        description: 'Test scenario tags'
        required: false
        type: boolean
      boolean_default_true:
        description: 'Test scenario tags'
        required: true
        type: boolean
        default: true
      boolean_default_false:
        description: 'Test scenario tags'
        required: false
        type: boolean
        default: false
      number1_default:
        description: 'Number w. default'
        default: '100'
        type: number
      number2:
        description: 'Number w/o. default'
        type: number
      string1_default:
        description: 'String w. default'
        default: 'Hello world'
        type: string
      string2:
        description: 'String w/o. default'
        required: true
        type: string

jobs:
  test:
    runs-on: docker
    steps:
      - uses: actions/checkout@v3
      - run: whoami
      - run: cat /etc/issue
      - run: uname -a
      - run: date
      - run: echo ${{ inputs.logLevel }}
      - run: echo ${{ inputs.tags }}
      - env:
          GITHUB_CONTEXT: ${{ toJson(github) }}
        run: echo "$GITHUB_CONTEXT"
      - run: echo "abc"
```
</details>

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3334
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Co-authored-by: Mai-Lapyst <mai-lapyst@noreply.codeberg.org>
Co-committed-by: Mai-Lapyst <mai-lapyst@noreply.codeberg.org>
2024-06-28 05:17:11 +00:00
..
locale_ar.ini [I18N] Translations update from Weblate (#3992) 2024-06-10 18:41:20 +00:00
locale_be.ini [I18N] Translations update from Weblate (#2521) 2024-03-04 01:58:49 +00:00
locale_bg.ini [I18N] Translations update from Weblate (#3851) 2024-05-25 18:32:20 +00:00
locale_bn.ini [I18N] Translations update from Weblate (#2350) 2024-02-17 22:18:04 +00:00
locale_bs.ini s/return_to_gitea/return_to_forgejo (#3822) 2024-05-20 18:44:33 +00:00
locale_ca.ini s/return_to_gitea/return_to_forgejo (#3822) 2024-05-20 18:44:33 +00:00
locale_cs-CZ.ini i18n: Translations update from Weblate (#4168) 2024-06-26 11:07:32 +00:00
locale_de-DE.ini i18n: Translations update from Weblate (#4168) 2024-06-26 11:07:32 +00:00
locale_el-GR.ini Refactor install page hints (#3961) 2024-06-02 13:06:56 +00:00
locale_en-US.ini Add support for workflow_dispatch (#3334) 2024-06-28 05:17:11 +00:00
locale_eo.ini Refactor install page hints (#3961) 2024-06-02 13:06:56 +00:00
locale_es-ES.ini Refactor install page hints (#3961) 2024-06-02 13:06:56 +00:00
locale_fa-IR.ini Refactor install page hints (#3961) 2024-06-02 13:06:56 +00:00
locale_fi-FI.ini Refactor install page hints (#3961) 2024-06-02 13:06:56 +00:00
locale_fil.ini i18n: Translations update from Weblate (#4168) 2024-06-26 11:07:32 +00:00
locale_fr-FR.ini [I18N] Translations update from Weblate (#4098) 2024-06-18 05:27:03 +00:00
locale_gl.ini i18n: Translations update from Weblate (#4168) 2024-06-26 11:07:32 +00:00
locale_hi.ini [I18N] Translations update from Weblate (#3508) 2024-05-04 18:36:49 +00:00
locale_hu-HU.ini Refactor install page hints (#3961) 2024-06-02 13:06:56 +00:00
locale_id-ID.ini [I18N] Injected updated time in translation string (#3837) 2024-05-20 18:47:35 +00:00
locale_is-IS.ini Refactor install page hints (#3961) 2024-06-02 13:06:56 +00:00
locale_it-IT.ini Refactor install page hints (#3961) 2024-06-02 13:06:56 +00:00
locale_ja-JP.ini [I18N] Translations update from Weblate (#4098) 2024-06-18 05:27:03 +00:00
locale_ko-KR.ini i18n: Translations update from Weblate (#4168) 2024-06-26 11:07:32 +00:00
locale_lv-LV.ini Refactor install page hints (#3961) 2024-06-02 13:06:56 +00:00
locale_nl-NL.ini i18n: Translations update from Weblate (#4168) 2024-06-26 11:07:32 +00:00
locale_pl-PL.ini Refactor install page hints (#3961) 2024-06-02 13:06:56 +00:00
locale_pt-BR.ini [I18N] Translations update from Weblate (#4098) 2024-06-18 05:27:03 +00:00
locale_pt-PT.ini [I18N] Translations update from Weblate (#4098) 2024-06-18 05:27:03 +00:00
locale_ru-RU.ini i18n: Translations update from Weblate (#4168) 2024-06-26 11:07:32 +00:00
locale_si-LK.ini Refactor install page hints (#3961) 2024-06-02 13:06:56 +00:00
locale_sk-SK.ini Refactor install page hints (#3961) 2024-06-02 13:06:56 +00:00
locale_sl.ini [I18N] Translations update from Weblate (#3992) 2024-06-10 18:41:20 +00:00
locale_sv-SE.ini Refactor install page hints (#3961) 2024-06-02 13:06:56 +00:00
locale_tr-TR.ini Refactor install page hints (#3961) 2024-06-02 13:06:56 +00:00
locale_uk-UA.ini Refactor install page hints (#3961) 2024-06-02 13:06:56 +00:00
locale_zh-CN.ini i18n: Translations update from Weblate (#4168) 2024-06-26 11:07:32 +00:00
locale_zh-HK.ini Refactor install page hints (#3961) 2024-06-02 13:06:56 +00:00
locale_zh-TW.ini [I18N] Translations update from Weblate (#3992) 2024-06-10 18:41:20 +00:00
TRANSLATORS Fix missing left and right carets in TRANSLATORS (#21397) 2022-10-10 10:36:37 -04:00