mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-22 23:33:15 -05:00
Update documentation for 1.21 actions (#26317)
As title. Close #26309 Related to #24724, #24806
This commit is contained in:
parent
96f151392f
commit
0da8ebc95b
2 changed files with 60 additions and 4 deletions
|
@ -245,8 +245,7 @@ You can find more useful images on [act images](https://github.com/nektos/act/bl
|
||||||
If you want to run jobs in the host directly, you can change it to `ubuntu-22.04:host` or just `ubuntu-22.04`, the `:host` is optional.
|
If you want to run jobs in the host directly, you can change it to `ubuntu-22.04:host` or just `ubuntu-22.04`, the `:host` is optional.
|
||||||
However, we suggest you to use a special name like `linux_amd64:host` or `windows:host` to avoid misusing it.
|
However, we suggest you to use a special name like `linux_amd64:host` or `windows:host` to avoid misusing it.
|
||||||
|
|
||||||
One more thing is that it is recommended to register the runner if you want to change the labels.
|
After Gitea 1.21 released, you can change labels by modfiying `container.labels` in configuration file (if you don't have a configuration file, please refer to [configuration tutorials](#configuration)), and runner will declare the new labels which you defined in configuration file after executing `./act_runner daemon --config config.yaml`.
|
||||||
It may be annoying to do this, so we may provide a better way to do it in the future.
|
|
||||||
|
|
||||||
## Running
|
## Running
|
||||||
|
|
||||||
|
@ -261,3 +260,32 @@ After you have registered the runner, you can run it by running the following co
|
||||||
The runner will fetch jobs from the Gitea instance and run them automatically.
|
The runner will fetch jobs from the Gitea instance and run them automatically.
|
||||||
|
|
||||||
Since act runner is still in development, it is recommended to check the latest version and upgrade it regularly.
|
Since act runner is still in development, it is recommended to check the latest version and upgrade it regularly.
|
||||||
|
|
||||||
|
## Configuration variable
|
||||||
|
|
||||||
|
You can create configuration varibales with user, organization, repository level. And the level of the variable depends on which setting panel you created in.
|
||||||
|
|
||||||
|
### Naming conventions
|
||||||
|
|
||||||
|
The following rules apply to variable names:
|
||||||
|
|
||||||
|
- Varibale names can only contain alphanumeric characters (`[a-z]`, `[A-Z]`, `[0-9]`) or underscores (`_`). Spaces are not allowed.
|
||||||
|
|
||||||
|
- Varibale names must not start with the `GITHUB_` and `GITEA_` prefix.
|
||||||
|
|
||||||
|
- Varibale names must not start with a number.
|
||||||
|
|
||||||
|
- Varibale names are not case-sensitive.
|
||||||
|
|
||||||
|
- Varibale names must be unique at the level they are created at.
|
||||||
|
|
||||||
|
- Varibale names must not be 'CI'.
|
||||||
|
|
||||||
|
### Using varibales
|
||||||
|
|
||||||
|
After creating configuration varibales, they will be automatically filled in the `vars` context. They are available to you with expression like `{{ vars.VARIABLE_NAME }}` in workflow.
|
||||||
|
|
||||||
|
### Precedence
|
||||||
|
|
||||||
|
If a variable with the same name exists at multiple levels, the variable at the lowest level takes precedence(the level of organization and user is higher than repository's).
|
||||||
|
For example, if an organization-level variable has the same name as a repository-level variable, then the repository-level variable takes precedence.
|
||||||
|
|
|
@ -241,8 +241,7 @@ Runner的标签用于确定Runner可以运行哪些Job以及如何运行它们
|
||||||
如果您想直接在主机上运行Job,您可以将其更改为`ubuntu-22.04:host`或仅`ubuntu-22.04`,`:host`是可选的。
|
如果您想直接在主机上运行Job,您可以将其更改为`ubuntu-22.04:host`或仅`ubuntu-22.04`,`:host`是可选的。
|
||||||
然而,我们建议您使用类似`linux_amd64:host`或`windows:host`的特殊名称,以避免误用。
|
然而,我们建议您使用类似`linux_amd64:host`或`windows:host`的特殊名称,以避免误用。
|
||||||
|
|
||||||
还有一点需要注意的是,建议在更改标签时注册Runner。
|
Gitea 1.21 发布后,您可以通过修改配置文件中的 `container.labels` 来更改标签(如果没有配置文件,请参考 [配置教程](#配置)),执行 `./act_runner daemon --config config.yaml` 命令后,它会向 Gitea 声明您在配置文件中定义的新标签。
|
||||||
这可能会有些麻烦,所以我们可能会在将来提供更好的方法来处理。
|
|
||||||
|
|
||||||
## 运行
|
## 运行
|
||||||
|
|
||||||
|
@ -257,3 +256,32 @@ Runner的标签用于确定Runner可以运行哪些Job以及如何运行它们
|
||||||
Runner将从Gitea实例获取Job并自动运行它们。
|
Runner将从Gitea实例获取Job并自动运行它们。
|
||||||
|
|
||||||
由于Act Runner仍处于开发中,建议定期检查最新版本并进行升级。
|
由于Act Runner仍处于开发中,建议定期检查最新版本并进行升级。
|
||||||
|
|
||||||
|
## 变量
|
||||||
|
|
||||||
|
您可以创建用户、组织和仓库级别的变量。变量的级别是取决于你在哪个设置面板中创建它们的。
|
||||||
|
|
||||||
|
### 命名规则
|
||||||
|
|
||||||
|
以下规则适用于变量名:
|
||||||
|
|
||||||
|
- 变量名称只能包含字母数字字符 (`[a-z]`, `[A-Z]`, `[0-9]`) 或下划线 (`_`)。不允许使用空格。
|
||||||
|
|
||||||
|
- 变量名称不能以 `GITHUB_` 和 `GITEA_` 前缀开头。
|
||||||
|
|
||||||
|
- 变量名称不能以数字开头。
|
||||||
|
|
||||||
|
- 变量名称不区分大小写。
|
||||||
|
|
||||||
|
- 变量名称在创建它们的级别上必须是唯一的。
|
||||||
|
|
||||||
|
- 变量名称不能为 “CI”。
|
||||||
|
|
||||||
|
### 使用
|
||||||
|
|
||||||
|
创建配置变量后,它们将自动填充到 `vars` 上下文中。您可以在工作流中使用类似 `{{ vars.VARIABLE_NAME }}` 这样的表达式来使用它们。
|
||||||
|
|
||||||
|
### 优先级
|
||||||
|
|
||||||
|
如果同名变量存在于多个级别,则级别最低的变量优先(组织和用户的级别高于仓库)。
|
||||||
|
比如,如果组织级变量与仓库级变量同名,则仓库变量优先。
|
||||||
|
|
Loading…
Reference in a new issue