Go to file
qxa c2b2159d77 更新 action.yaml 2026-01-21 17:11:24 +08:00
.gitea/workflows first commit 2025-03-25 18:25:17 +08:00
dist first commit 2025-03-25 18:25:17 +08:00
.gitattributes first commit 2025-03-25 18:25:17 +08:00
.gitignore first commit 2025-03-25 18:25:17 +08:00
README.md 增加说明文档 2025-11-06 11:45:54 +08:00
action.yaml 更新 action.yaml 2026-01-21 17:11:24 +08:00
config.js first commit 2025-03-25 18:25:17 +08:00
package.json first commit 2025-03-25 18:25:17 +08:00
restore.js first commit 2025-03-25 18:25:17 +08:00
save.js first commit 2025-03-25 18:25:17 +08:00

README.md

缓存插件

这是一个Gitea Actions缓存插件用于在CI/CD流程中缓存指定目录以提高构建效率减少重复下载和计算时间。

功能特点

  • 支持多目录缓存
  • 基于文件哈希自动更新缓存
  • 支持不同操作系统环境
  • 提供缓存命中状态输出

输入参数

参数名 必需 描述 默认值
key 缓存压缩标识 ${{ gitea.repository }}
mount 挂载缓存目录(支持多行输入) -
hash_files 缓存命中文件(支持多行输入,用于生成哈希) -

输出参数

参数名 描述
cache_init 是否缓存命中("true"或"false"

使用示例

- name: 缓存依赖
  uses: actions/cache@master
  with:
    key: node-modules
    mount: |
      node_modules      
    hash_files: |
      package.json
      yarn.lock      

工作原理

  1. 恢复缓存restore在作业开始时根据提供的key和hash_files生成缓存键尝试恢复缓存
  2. 保存缓存save:在作业成功完成后,如果缓存未命中或内容发生变化,则保存新的缓存

缓存键生成规则:${操作系统}-${key}-${文件哈希值}

安装和构建

# 安装依赖
yarn install

# 构建插件
yarn build

构建后的文件将输出到dist/restore/dist/save/目录中。