Skip to content

Gitea Actions - Support for configuration variables in workflows #30393

Closed
@kerem0comert

Description

@kerem0comert

Feature Description

Hello,

In my Gitea Actions configuration - suppose that I would like to be able to configure the behavior of certain steps.
For example, consider the following step:

    - name: Run pytest
      run: |
        if [ -d tests/ ]; then
          if [ -f tests/gitea_actions.yaml ]; then
            echo "Found gitea_actions.yaml, checking if tests should be run..."
            
            run_tests=$(python -c "import yaml; print(yaml.safe_load(open('tests/gitea_actions.yaml'))['run_tests'])")
            echo "run_tests is set to $run_tests"
            if [ "$run_tests" = "True" ]; then
              echo "run_tests is set to true, running tests..."
              python -m pytest tests/
            else
              echo "run_tests is not set to true, skipping tests."
            fi
          else
            echo "gitea_actions.yaml does not exist, skipping tests."
          fi
        else
          echo "Test directory does not exist, skipping tests."
        fi

Currently I can configure this behavior by a yaml file that I keep in the repository. However, is it possible to have it as an external variable that is configurable per repository, in the Gitea frontend? And it can be accessed in a way like gitea.actor. I assume this is similar to what GitHub Actions already supports here.

Please let me know if such a thing already exists, or if not what is the best practice for this requirement (should I continue having this external yaml file for my configs?).

Thanks!

Screenshots

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    issue/needs-feedbackFor bugs, we need more details. For features, the feature must be described in more detailtype/proposalThe new feature has not been accepted yet but needs to be discussed first.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions