Template
1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo synced 2024-11-22 09:54:24 +01:00
forgejo/web_src/css
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
..
chroma [Port] gitea#30014: Various code view improvements 2024-03-28 16:43:14 +01:00
codemirror Remove EasyMDE focus outline on text (#25328) 2023-06-18 04:10:07 +00:00
editor Clean up diff header css and reduce global textarea min-height (#29232) 2024-02-19 22:58:33 +01:00
features Size/gap changes and cleanup in commit graph (#4214) 2024-06-24 18:59:57 +00:00
markup Fix margin above headline in rendered org-mode (#4076) 2024-06-11 03:34:21 +00:00
modules Change --border-radius-circle to --border-radius-full (gitea#30936) 2024-05-27 13:15:20 +02:00
repo Merge pull request '[gitea] week 2024-22 cherry pick (gitea/main -> forgejo)' (#3917) from earl-warren/wcp/2024-22 into forgejo 2024-05-28 10:50:48 +00:00
shared Forbid deprecated break-word in CSS (#30934) 2024-05-12 20:03:10 +02:00
standalone Add toasts to UI (#25449) 2023-06-27 02:45:24 +00:00
themes [FEAT] Adds x-mode-only anchor styles to display images based if the theme is light or dark mode. (#3985) 2024-06-09 10:50:53 +00:00
actions.css Add support for workflow_dispatch (#3334) 2024-06-28 05:17:11 +00:00
admin.css User details page (#26713) 2023-08-31 11:21:18 +02:00
base.css Merge pull request '[gitea] week 2024-22 cherry pick (gitea/main -> forgejo)' (#3917) from earl-warren/wcp/2024-22 into forgejo 2024-05-28 10:50:48 +00:00
dashboard.css Pulse page improvements (#30149) 2024-04-21 11:08:33 +02:00
explore.css [Port] gitea#29982 Introduce .secondary-nav and handle .page-content spacing universally 2024-03-28 16:43:09 +01:00
font_i18n.css Fix @font-face overrides (#24855) 2023-05-24 01:48:51 +00:00
form.css [FEAT] expose fuzzy search for issues/repo (#4160) 2024-06-17 18:58:24 +00:00
helpers.css Merge pull request 'Replace gt-word-break with tw-break-anywhere' (#4102) from 0ko/forgejo:ui-replace-gt-word-break into forgejo 2024-06-11 10:39:03 +00:00
home.css [BRANDING] Add Forgejo light, dark, and auto themes 2024-02-05 16:02:13 +01:00
index.css Remove fomantic list module (#30281) 2024-04-07 15:40:31 +02:00
install.css UI improvements to optional sections in installation page (#4062) 2024-06-07 17:57:54 +00:00
org.css Fix org view on mobile for members (#3949) 2024-06-04 04:08:54 +00:00
repo.css Fix labels and projects menu overflow on issue page (#31435) 2024-06-23 12:41:07 +02:00
review.css Fix: The interface is broken when modifying code comments under mobile devices (#30125) 2024-03-30 07:17:31 +01:00
user.css Unify vertical and horizontal paddings in markup file view (#3944) 2024-05-31 03:38:45 +00:00