delete-artifact 项目使用教程

delete-artifact 项目使用教程

delete-artifact A GitHub Action to deletes artifacts within the workflow run. delete-artifact 项目地址: https://gitcode.com/gh_mirrors/de/delete-artifact

1. 项目目录结构及介绍

delete-artifact/
├── .github/
│   └── workflows/
│       └── action.yml
├── dist/
├── src/
│   ├── index.ts
│   └── ...
├── .editorconfig
├── .gitignore
├── CHANGELOG.md
├── LICENSE
├── README.md
├── action.yml
├── package-lock.json
├── package.json
└── tsconfig.json

目录结构介绍

  • .github/workflows/: 包含GitHub Actions的工作流配置文件。
  • dist/: 编译后的TypeScript文件存放目录。
  • src/: 源代码目录,包含TypeScript文件。
  • .editorconfig: 编辑器配置文件,用于统一代码风格。
  • .gitignore: Git忽略文件配置。
  • CHANGELOG.md: 项目更新日志。
  • LICENSE: 项目许可证文件。
  • README.md: 项目介绍和使用说明。
  • action.yml: GitHub Action的配置文件。
  • package-lock.json: 锁定npm包版本。
  • package.json: 项目依赖和脚本配置。
  • tsconfig.json: TypeScript配置文件。

2. 项目启动文件介绍

项目的启动文件位于src/index.ts。这个文件是TypeScript代码的入口点,负责处理删除GitHub Actions工作流中的artifacts。

// src/index.ts
import { deleteArtifact } from './deleteArtifact';

// 启动逻辑
deleteArtifact();

3. 项目的配置文件介绍

action.yml

action.yml 是GitHub Action的配置文件,定义了Action的输入、输出和运行环境。

name: 'Delete Artifact'
description: 'A GitHub Action to delete artifacts within the workflow run'
inputs:
  name:
    description: 'Name of the artifact to delete'
    required: true
  failOnError:
    description: 'Whether to fail the action if an artifact cannot be deleted'
    required: false
    default: true
runs:
  using: 'node16'
  main: 'dist/index.js'

package.json

package.json 是npm包的配置文件,定义了项目的依赖、脚本和元数据。

{
  "name": "delete-artifact",
  "version": "1.0.0",
  "description": "A GitHub Action to delete artifacts within the workflow run",
  "main": "dist/index.js",
  "scripts": {
    "build": "tsc",
    "test": "jest"
  },
  "dependencies": {
    "@actions/core": "^1.2.6",
    "@actions/github": "^4.0.0"
  },
  "devDependencies": {
    "@types/jest": "^26.0.20",
    "jest": "^26.6.3",
    "typescript": "^4.1.3"
  }
}

tsconfig.json

tsconfig.json 是TypeScript的配置文件,定义了TypeScript编译器的选项。

{
  "compilerOptions": {
    "target": "ES2019",
    "module": "commonjs",
    "strict": true,
    "esModuleInterop": true,
    "skipLibCheck": true,
    "forceConsistentCasingInFileNames": true,
    "outDir": "./dist"
  },
  "include": ["src/**/*"]
}

通过以上配置文件和目录结构,您可以更好地理解和使用delete-artifact项目。

delete-artifact A GitHub Action to deletes artifacts within the workflow run. delete-artifact 项目地址: https://gitcode.com/gh_mirrors/de/delete-artifact

创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

侯宜伶Ernestine

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值