Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

workflow_dispatch does not validate input type number, accepts strings #33652

Open
PDCuong opened this issue Feb 20, 2025 · 1 comment
Open
Labels
topic/gitea-actions related to the actions of Gitea type/bug

Comments

@PDCuong
Copy link

PDCuong commented Feb 20, 2025

Description

In Gitea v1.23, when using workflow_dispatch in actions, the number input type is not properly validated. It accepts string values instead of enforcing numeric input.

Gitea Version

v1.23

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

Define a workflow with an input of type number:

on:
  push:
  workflow_dispatch:
    inputs:
      number_required_1:
        description: 'number-1 '
        type: number
        required: true
        default: '100'
      number_required_2:
        description: 'number-2'
        type: number
        required: true
        default: '100'
      number_required_3:
        description: 'number-3'
        type: number
        required: true
        default: '100'
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - run: echo "Demo non-main branch"
      - run: env | grep inputs

Trigger the workflow manually and enter a string value (e.g., "abc").
The workflow proceeds without validation, even though build_number is expected to be a number.

-> Action logs:

inputs_number_required_3=100
inputs_number_required_2=abc
inputs_number_required_1=100

Trigger the workflow manually and enter a string value (e.g., "abc").
The workflow proceeds without validation, even though build_number is expected to be a number.

Operating System

ubuntu 22.04 LTS

How are you running Gitea?

in docker

Database

None

@kemzeb kemzeb added the topic/gitea-actions related to the actions of Gitea label Feb 20, 2025
@ChristopherHX
Copy link
Contributor

The last time I looked into the "number" type in dispatch, the result was the exact same between GitHub Actions and Gitea Actions e.g. number behaves exactly like string and becomes type string for the inputs context.

(workflow_call has a number type that is validated and has the correct type in the inputs context)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic/gitea-actions related to the actions of Gitea type/bug
Projects
None yet
Development

No branches or pull requests

3 participants