-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Update actions variables documents #30394
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
Merged
wolfogre
merged 5 commits into
go-gitea:main
from
lunny:lunny/update_actions_variables_doc
Apr 11, 2024
Merged
Changes from 2 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
854e5a8
Update actions variables documents
lunny d2c8b41
Apply suggestions from code review
lunny 4e1bb48
Update docs/content/usage/actions/variables.zh-cn.md
lunny b462fd1
Merge branch 'main' into lunny/update_actions_variables_doc
lunny 4590bdd
Merge branch 'main' into lunny/update_actions_variables_doc
lunny File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
--- | ||
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 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 | ||
|
||
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
--- | ||
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 }}` 这样的表达式来使用它们。 | ||
|
||
### 优先级 | ||
|
||
如果同名变量存在于多个级别,则级别最低的变量优先。 | ||
仓库级别的变量总是比组织或者用户级别的变量优先被选中。 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.