From 854e5a8fb9ce0ae6a6084649194e2cdf1457d30d Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Wed, 10 Apr 2024 22:25:50 +0800 Subject: [PATCH 1/3] Update actions variables documents --- .../content/usage/actions/act-runner.en-us.md | 31 ------------- .../content/usage/actions/act-runner.zh-cn.md | 29 ------------ docs/content/usage/actions/variables.en-us.md | 46 +++++++++++++++++++ docs/content/usage/actions/variables.zh-cn.md | 44 ++++++++++++++++++ 4 files changed, 90 insertions(+), 60 deletions(-) create mode 100644 docs/content/usage/actions/variables.en-us.md create mode 100644 docs/content/usage/actions/variables.zh-cn.md diff --git a/docs/content/usage/actions/act-runner.en-us.md b/docs/content/usage/actions/act-runner.en-us.md index b2806bf5dd32..942d12691928 100644 --- a/docs/content/usage/actions/act-runner.en-us.md +++ b/docs/content/usage/actions/act-runner.en-us.md @@ -303,34 +303,3 @@ sudo systemctl enable act_runner --now ``` If using Docker, the `act_runner` user should also be added to the `docker` group before starting the service. Keep in mind that this effectively gives `act_runner` root access to the system [[1]](https://docs.docker.com/engine/security/#docker-daemon-attack-surface). - -## Configuration variable - -You can create configuration variables on the user, organization and repository level. -The level of the variable depends on where you created it. - -### Naming conventions - -The following rules apply to variable names: - -- Variable names can only contain alphanumeric characters (`[a-z]`, `[A-Z]`, `[0-9]`) or underscores (`_`). Spaces are not allowed. - -- Variable names must not start with the `GITHUB_` and `GITEA_` prefix. - -- Variable names must not start with a number. - -- Variable names are case-insensitive. - -- Variable names must be unique at the level they are created at. - -- Variable names must not be `CI`. - -### Using variable - -After creating configuration variables, they will be automatically filled in the `vars` context. -They can be accessed through expressions like `{{ vars.VARIABLE_NAME }}` in the workflow. - -### Precedence - -If a variable with the same name exists at multiple levels, the variable at the lowest level takes precedence: -A repository variable will always be chosen over an organization/user variable. diff --git a/docs/content/usage/actions/act-runner.zh-cn.md b/docs/content/usage/actions/act-runner.zh-cn.md index 274b0f06922e..e5ebff976d9c 100644 --- a/docs/content/usage/actions/act-runner.zh-cn.md +++ b/docs/content/usage/actions/act-runner.zh-cn.md @@ -258,32 +258,3 @@ Runner的标签用于确定Runner可以运行哪些Job以及如何运行它们 Runner将从Gitea实例获取Job并自动运行它们。 由于Act Runner仍处于开发中,建议定期检查最新版本并进行升级。 - -## 变量 - -您可以创建用户、组织和仓库级别的变量。变量的级别取决于创建它的位置。 - -### 命名规则 - -以下规则适用于变量名: - -- 变量名称只能包含字母数字字符 (`[a-z]`, `[A-Z]`, `[0-9]`) 或下划线 (`_`)。不允许使用空格。 - -- 变量名称不能以 `GITHUB_` 和 `GITEA_` 前缀开头。 - -- 变量名称不能以数字开头。 - -- 变量名称不区分大小写。 - -- 变量名称在创建它们的级别上必须是唯一的。 - -- 变量名称不能为 “CI”。 - -### 使用 - -创建配置变量后,它们将自动填充到 `vars` 上下文中。您可以在工作流中使用类似 `{{ vars.VARIABLE_NAME }}` 这样的表达式来使用它们。 - -### 优先级 - -如果同名变量存在于多个级别,则级别最低的变量优先。 -仓库级别的变量总是比组织或者用户级别的变量优先被选中。 diff --git a/docs/content/usage/actions/variables.en-us.md b/docs/content/usage/actions/variables.en-us.md new file mode 100644 index 000000000000..8e92870f87d3 --- /dev/null +++ b/docs/content/usage/actions/variables.en-us.md @@ -0,0 +1,46 @@ +--- +date: "2024-04-10T22:21:00+08:00" +title: "Variables" +slug: "actions-variables" +sidebar_position: 25 +draft: false +toc: false +menu: + sidebar: + parent: "actions" + name: "Variables" + sidebar_position: 25 + identifier: "actions-variables" +--- + +## Variables + +You can create configuration variables on the user, organization and repository level. +The level of the variable depends on where you created it. When creating a variable, the +key will be converted as uppercase. You need use uppercase on the yaml file. + +### Naming conventions + +The following rules apply to variable names: + +- Variable names can only contain alphanumeric characters (`[a-z]`, `[A-Z]`, `[0-9]`) or underscores (`_`). Spaces are not allowed. + +- Variable names must not start with the `GITHUB_` and `GITEA_` prefix. + +- Variable names must not start with a number. + +- Variable names are case-insensitive. + +- Variable names must be unique at the level they are created at. + +- Variable names must not be `CI`. + +### Using variable + +After creating configuration variables, they will be automatically filled in the `vars` context. +They can be accessed through expressions like `${{ vars.VARIABLE_NAME }}` in the workflow. + +### Precedence + +If a variable with the same name exists at multiple levels, the variable at the lowest level takes precedence: +A repository variable will always be chosen over an organization/user variable. diff --git a/docs/content/usage/actions/variables.zh-cn.md b/docs/content/usage/actions/variables.zh-cn.md new file mode 100644 index 000000000000..8bb15bcbd295 --- /dev/null +++ b/docs/content/usage/actions/variables.zh-cn.md @@ -0,0 +1,44 @@ +--- +date: "2024-04-10T22:21:00+08:00" +title: "变量" +slug: "actions-variables" +sidebar_position: 25 +draft: false +toc: false +menu: + sidebar: + parent: "actions" + name: "变量" + sidebar_position: 25 + identifier: "actions-variables" +--- + +## 变量 + +您可以创建用户、组织和仓库级别的变量。变量的级别取决于创建它的位置。当创建变量时,变量的名称会被 +转换为大写,在yaml文件中引用时需要使用大写。 + +### 命名规则 + +以下规则适用于变量名: + +- 变量名称只能包含字母数字字符 (`[a-z]`, `[A-Z]`, `[0-9]`) 或下划线 (`_`)。不允许使用空格。 + +- 变量名称不能以 `GITHUB_` 和 `GITEA_` 前缀开头。 + +- 变量名称不能以数字开头。 + +- 变量名称不区分大小写。 + +- 变量名称在创建它们的级别上必须是唯一的。 + +- 变量名称不能为 “CI”。 + +### 使用 + +创建配置变量后,它们将自动填充到 `vars` 上下文中。您可以在工作流中使用类似 `${{ vars.VARIABLE_NAME }}` 这样的表达式来使用它们。 + +### 优先级 + +如果同名变量存在于多个级别,则级别最低的变量优先。 +仓库级别的变量总是比组织或者用户级别的变量优先被选中。 From d2c8b416ad045ac6605cf287f83c6d7b03743416 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Thu, 11 Apr 2024 09:41:51 +0800 Subject: [PATCH 2/3] Apply suggestions from code review Co-authored-by: silverwind --- docs/content/usage/actions/variables.en-us.md | 7 +------ docs/content/usage/actions/variables.zh-cn.md | 5 ----- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/docs/content/usage/actions/variables.en-us.md b/docs/content/usage/actions/variables.en-us.md index 8e92870f87d3..dee2e74234d5 100644 --- a/docs/content/usage/actions/variables.en-us.md +++ b/docs/content/usage/actions/variables.en-us.md @@ -17,22 +17,17 @@ menu: You can create configuration variables on the user, organization and repository level. The level of the variable depends on where you created it. When creating a variable, the -key will be converted as uppercase. You need use uppercase on the yaml file. +key will be converted to uppercase. You need use uppercase on the yaml file. ### Naming conventions The following rules apply to variable names: - Variable names can only contain alphanumeric characters (`[a-z]`, `[A-Z]`, `[0-9]`) or underscores (`_`). Spaces are not allowed. - - Variable names must not start with the `GITHUB_` and `GITEA_` prefix. - - Variable names must not start with a number. - - Variable names are case-insensitive. - - Variable names must be unique at the level they are created at. - - Variable names must not be `CI`. ### Using variable diff --git a/docs/content/usage/actions/variables.zh-cn.md b/docs/content/usage/actions/variables.zh-cn.md index 8bb15bcbd295..a657d0ccb16a 100644 --- a/docs/content/usage/actions/variables.zh-cn.md +++ b/docs/content/usage/actions/variables.zh-cn.md @@ -23,15 +23,10 @@ menu: 以下规则适用于变量名: - 变量名称只能包含字母数字字符 (`[a-z]`, `[A-Z]`, `[0-9]`) 或下划线 (`_`)。不允许使用空格。 - - 变量名称不能以 `GITHUB_` 和 `GITEA_` 前缀开头。 - - 变量名称不能以数字开头。 - - 变量名称不区分大小写。 - - 变量名称在创建它们的级别上必须是唯一的。 - - 变量名称不能为 “CI”。 ### 使用 From 4e1bb48267640e40b632820a153bbb22619340ba Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Thu, 11 Apr 2024 11:02:27 +0800 Subject: [PATCH 3/3] Update docs/content/usage/actions/variables.zh-cn.md Co-authored-by: Zettat123 --- docs/content/usage/actions/variables.zh-cn.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/content/usage/actions/variables.zh-cn.md b/docs/content/usage/actions/variables.zh-cn.md index a657d0ccb16a..77643408a182 100644 --- a/docs/content/usage/actions/variables.zh-cn.md +++ b/docs/content/usage/actions/variables.zh-cn.md @@ -27,7 +27,7 @@ menu: - 变量名称不能以数字开头。 - 变量名称不区分大小写。 - 变量名称在创建它们的级别上必须是唯一的。 -- 变量名称不能为 “CI”。 +- 变量名称不能为 `CI`。 ### 使用