{"id":30662455,"url":"https://github.com/ben-lau/task-workflow","last_synced_at":"2025-08-31T16:03:57.350Z","repository":{"id":65514733,"uuid":"306211216","full_name":"ben-lau/task-workflow","owner":"ben-lau","description":"For automated execution of standardized processes, support asynchronous or custom tasks, and contains some amazing tasks","archived":false,"fork":false,"pushed_at":"2023-03-02T03:52:28.000Z","size":438,"stargazers_count":8,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-23T05:58:58.238Z","etag":null,"topics":["async","cicd","git","task","workflow"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ben-lau.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-10-22T03:23:22.000Z","updated_at":"2023-03-07T10:35:24.000Z","dependencies_parsed_at":"2023-01-26T21:05:27.628Z","dependency_job_id":null,"html_url":"https://github.com/ben-lau/task-workflow","commit_stats":null,"previous_names":[],"tags_count":53,"template":false,"template_full_name":null,"purl":"pkg:github/ben-lau/task-workflow","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ben-lau%2Ftask-workflow","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ben-lau%2Ftask-workflow/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ben-lau%2Ftask-workflow/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ben-lau%2Ftask-workflow/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ben-lau","download_url":"https://codeload.github.com/ben-lau/task-workflow/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ben-lau%2Ftask-workflow/sbom","scorecard":{"id":231228,"data":{"date":"2025-08-11","repo":{"name":"github.com/ben-lau/task-workflow","commit":"8899db1d811afb6d20cc939ee0898cd58093f94f"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.3,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":0,"reason":"11 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-82v2-mx6x-wq7q","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-gcx4-mw62-g8wm","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-hxcc-f52p-wc94","Warn: Project is vulnerable to: GHSA-76p7-773f-r4q5","Warn: Project is vulnerable to: GHSA-52f5-9888-hmc6","Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-17T04:54:27.943Z","repository_id":65514733,"created_at":"2025-08-17T04:54:27.943Z","updated_at":"2025-08-17T04:54:27.943Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273003115,"owners_count":25028999,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-31T02:00:09.071Z","response_time":79,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["async","cicd","git","task","workflow"],"created_at":"2025-08-31T16:03:53.338Z","updated_at":"2025-08-31T16:03:57.342Z","avatar_url":"https://github.com/ben-lau.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# task workflow\n\n用于一些标准化流程、步骤等，支持异步任务和自定义任务，包含了一些好用的任务。\n\n- [安装](#安装)\n- [使用](#使用)\n- [流程](#流程)\n- [任务](#任务)\n\n## 安装\n\n项目内安装：\n\n```bash\nnpm i task-workflow -D\n```\n\n也可以全局安装：\n\n```bash\nnpm i task-workflow -g\n```\n\n## 快速使用\n\n先创建一个配置文件：\n\n```javascript\n// workflow.config.js\nconst { Workflow, Tasks } = require('task-workflow');\n\nnew Workflow('to-self', {\n  description: '提交到远程',\n  steps: [\n    { name: '获取提交信息', use: Tasks.AskFor.commitMessage() },\n    { name: '提交', use: Tasks.Git.commit(message =\u003e [{ message }]) },\n    { name: '推送', use: Tasks.Git.push() },\n  ],\n});\n\nnew Workflow('build-and-link', {\n  description: '构建并本地测试',\n  steps: [\n    { name: '构建', use: Tasks.Shell.run({ cmd: 'npm run build' }) },\n    { name: '本地软链', use: Tasks.Shell.run({ cmd: 'npm link' }) },\n    { name: '测试', use: Tasks.Shell.run({ cmd: 'npm  test' }) },\n  ],\n});\n```\n\n完成后，可以使用命令行或者内置函数：\n\n```bash\nwork-start to-self --from workflow.config.js\n# work-start [workflowId] --from \u003cpath\u003e\n```\n\n或\n\n```javascript\nimport { workStart } from 'task-workflow';\n\nworkStart({\n  from: 'workflow.config.js',\n  workflowId: 'to-self',\n});\n```\n\n## 流程\n\n创建一个流程需使用到 Workflow\n\n### API：\n\n- `name` **{ string }** 工作流 id\n- `options` **{ object }** 工作流的配置\n  - `description` **{ String }** 工作流名称、描述\n  - `validate` **{ Function }** 工作流前置判断，返回为 true 才能开始，支持异步\n  - `steps` **{ Array\u003cobject | Function\u003e }** 流程，支持直接传任务函数、任务、配置\n    - `name` **{ string }** 本次任务名\n    - `use` **{ Task | Function }** **（必填）** 本次任务函数\n    - `skip` **{ Function }** 判断步骤是否需要跳过，返回为 true 会被跳过，支持异步，默认返回 false\n\n### 例子：\n\n```javascript\n// workflow.config.js\nconst { Workflow, Tasks } = require('./lib/index');\n\nnew Workflow('to-self', {\n  description: '提交到远程',\n  steps: [\n    {\n      name: '构建',\n      skip: async () =\u003e\n        !(await Tasks.AskFor.shouldContinue({ message: '是否需要构建？' })()),\n      use: Tasks.Shell.run({ cmd: 'npm run build' }),\n    },\n    { name: '获取提交信息', use: Tasks.AskFor.commitMessage() },\n    { name: '提交', use: Tasks.Git.commit(message =\u003e [{ message }]) },\n    { name: '推送', use: Tasks.Git.push() },\n  ],\n});\n```\n\n## 任务\n\nTasks 中包含了部分任务工厂函数：\n\n```javascript\nimport { Tasks } from 'task-workflow';\n```\n\nTasks 内所有模块下的任务都是工厂函数，都是一些柯里化函数。支持参数为函数，返回任务函数的原参数。\n\n### 使用方法:\n\n```javascript\nimport { Tasks } from 'task-workflow';\n\n// 任务工厂函数调用后返回的是个任务函数，是已经带上参数的执行函数\nconst task = Tasks.File.copyTo({ from: './__dist', to: './dist' });\n\n// 需要再次调用才真正执行\ntask();\n\n// 支持传入返回任务函数参数的函数，这样可以让参数在执行时再确定\n// 传入的函数的形参在workflow中为上一个任务的返回\nconst task2 = Tasks.File.copyTo(lastParams =\u003e [\n  { from: './__dist', to: './dist' },\n]);\n```\n\n**tips: 如果是需要在自己的函数内调用任务的，记得先创建后再调用**\n\n### Modules\n\n- `AskFor` cli 中询问的任务集合\n- `File` 关于文件系统的任务集合\n- `Git` 关于 git 操作的任务集合\n- `MergeRequest` 关于 gitlab 中 mr 的任务结合\n- `Shell` 关于 shell 指令的任务集合\n\n### todos\n\n- [x] 日志系统重构\n- [x] 修改 compose 实现\n- [x] 更好用的 shell\n- [x] 全局调用项目内部配置，静态挂载正确化\n- [x] git 模块方法的重构\n- [ ] 增加 task 错误钩子\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fben-lau%2Ftask-workflow","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fben-lau%2Ftask-workflow","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fben-lau%2Ftask-workflow/lists"}