gitea.cli.actions.workflow.dispatch
dispatch
Start an Actions workflow run.
The workflow has to declare a workflow_dispatch trigger: that is the trigger a
dispatch fires, so a workflow without one has nothing for this to start.
Gitea answers a dispatch with 204 and no body, which says the request was
accepted but not which run it started. --return-run-details asks the response
to name the run, so a caller can follow the run it dispatched rather than
guessing which of the runs that appeared is its own. An instance too old to know
the parameter ignores it and answers as before, which is why it is asked for
rather than assumed.
Classes
Functions:
gitea.cli.actions.workflow.dispatch.parse_inputs
Read the --input KEY=VALUE options into the inputs of a dispatch.
A value containing = is kept whole - --input query=a=b is the input
query set to a=b - since only the first separator can be the one
dividing the name from the value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
values
|
list[str] | None
|
The values passed as --input, or None when none were. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, str] | None
|
The inputs to send, or None when no --input was passed, so that a |
dict[str, str] | None
|
dispatch without inputs sends no |
dict[str, str] | None
|
empty object. |
Raises:
| Type | Description |
|---|---|
CommandError
|
If a value carries no |
Source code in src/gitea/cli/actions/workflow/dispatch.py
gitea.cli.actions.workflow.dispatch.dispatch_command
dispatch_command(
ctx: Context,
owner: Annotated[
str,
Option("--owner", help="Owner of the repository."),
],
workflow_id: Annotated[
str, Option("--workflow-id", help=WORKFLOW_ID_HELP)
],
ref: Annotated[
str,
Option(
"--ref",
help="Branch or tag to run the workflow on, e.g. main or refs/heads/main.",
),
],
repository: Annotated[
str | None,
Option(
"--repository", help=REPOSITORY_REQUIRED_HELP
),
] = None,
inputs: Annotated[
list[str] | None,
Option(
"--input",
help="An input of the workflow, as KEY=VALUE. Repeat to pass several.",
),
] = None,
return_run_details: Annotated[
bool,
Option(
"--return-run-details",
help="Ask the response to identify the run that was started, so it can be followed with 'gitea-cli actions run get'. Instances that do not offer this answer without a body, as they do without it.",
),
] = False,
account_name: Annotated[
str | None,
Option(
"--account-name",
help="Name of the account to use for authentication.",
),
] = None,
token: Annotated[
str | None,
Option(
"--token",
help="Token for authentication. If not provided, the token from the specified account will be used.",
),
] = None,
base_url: Annotated[
str | None,
Option(
"--base-url",
help="Base URL of the Gitea platform. If not provided, the base URL from the specified account will be used.",
),
] = None,
) -> None
Start a run of one workflow.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ctx
|
Context
|
The Typer context. |
required |
owner
|
Annotated[str, Option('--owner', help='Owner of the repository.')]
|
The owner of the repository. |
required |
workflow_id
|
Annotated[str, Option('--workflow-id', help=WORKFLOW_ID_HELP)]
|
The file name of the workflow. |
required |
ref
|
Annotated[str, Option('--ref', help='Branch or tag to run the workflow on, e.g. main or refs/heads/main.')]
|
The branch or tag to run the workflow on. |
required |
repository
|
Annotated[str | None, Option('--repository', help=REPOSITORY_REQUIRED_HELP)]
|
The name of the repository, which this command requires. |
None
|
inputs
|
Annotated[list[str] | None, Option('--input', help='An input of the workflow, as KEY=VALUE. Repeat to pass several.')]
|
The workflow's inputs, each as |
None
|
return_run_details
|
Annotated[bool, Option('--return-run-details', help="Ask the response to identify the run that was started, so it can be followed with 'gitea-cli actions run get'. Instances that do not offer this answer without a body, as they do without it.")]
|
Whether to ask the response to name the run started. |
False
|
account_name
|
Annotated[str | None, Option('--account-name', help='Name of the account to use for authentication.')]
|
Name of the account to use for authentication. |
None
|
token
|
Annotated[str | None, Option('--token', help='Token for authentication. If not provided, the token from the specified account will be used.')]
|
Token for authentication. |
None
|
base_url
|
Annotated[str | None, Option('--base-url', help='Base URL of the Gitea platform. If not provided, the base URL from the specified account will be used.')]
|
Base URL of the Gitea platform. |
None
|
Source code in src/gitea/cli/actions/workflow/dispatch.py
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 | |