Gitea Variables

Preset Variables

变量名称示例说明 / 用途
gitea.actor触发 workflow 的用户的用户名。(docs.gitea.com)
gitea.event_name事件名称,比如 pushpull_request 等。(docs.gitea.com)
gitea.ref被触发的 Git 引用(branch/tag/ref)名称。(docs.gitea.com)
gitea.repository仓库标识,一般是 owner/name。(docs.gitea.com)
gitea.workspace仓库被 checkout 到 runner 上的工作目录路径。(docs.gitea.com)

Common Variables

变量名称示例说明 / 用途
runner.osRunner 所在的操作系统环境,比如 ubuntu-latest。(docs.gitea.com)
job.status当前 job 的状态(例如 success 或 failure)。(docs.gitea.com)
env.xxxx自定义配置变量,在用户/组织/仓库层定义,统一以大写形式引用。(docs.gitea.com)
secrets.XXXX存放敏感信息的密钥,同样可以在用户/组织/仓库层定义。(docs.gitea.com)

Sample

name: Gitea Actions Demo
run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀
on: [push]

env:
    author: gitea_admin
jobs:
  Explore-Gitea-Actions:
    runs-on: ubuntu-latest
    steps:
      - run: echo "🎉 The job was automatically triggered by a ${{ gitea.event_name }} event."
      - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by Gitea!"
      - run: echo "🔎 The name of your branch is ${{ gitea.ref }} and your repository is ${{ gitea.repository }}."
      - name: Check out repository code
        uses: actions/checkout@v4
      - run: echo "💡 The ${{ gitea.repository }} repository has been cloned to the runner."
      - run: echo "🖥️ The workflow is now ready to test your code on the runner."
      - name: List files in the repository
        run: |
          ls ${{ gitea.workspace }}
      - run: echo "🍏 This job's status is ${{ job.status }}."

Result

🎉 The job was automatically triggered by a `push` event.

🐧 This job is now running on a `Linux` server hosted by Gitea!

🔎 The name of your branch is `refs/heads/main` and your repository is `gitea_admin/data-warehouse`.

💡 The `gitea_admin/data-warehouse` repository has been cloned to the runner.

🖥️ The workflow is now ready to test your code on the runner.

    Dockerfile  README.md  environments  pom.xml  src  templates

🍏 This job's status is `success`.