如何为 lint 和运行测试的拉取请求编写管道

Posted

技术标签:

【中文标题】如何为 lint 和运行测试的拉取请求编写管道【英文标题】:How to write a pipeline for a pull request for lint and run tests 【发布时间】:2021-12-20 19:25:51 【问题描述】:

我从未在 github 操作中编写管道,我被要求使用以下命令为 github 中的存储库的拉取请求创建管道:

npm run lint;
npm run test;

【问题讨论】:

【参考方案1】:

GitHub 自己的setup-nodeAction 提供了如何执行此操作的示例。根据那里的文档,将这样的东西放在.github/workflows 目录中的 YAML 文件中应该可以工作:

steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
  with:
    node-version: '16'
- run: npm install
- run: npm lint
- run: npm test

【讨论】:

以上是关于如何为 lint 和运行测试的拉取请求编写管道的主要内容,如果未能解决你的问题,请参考以下文章

如何在 Azure DevOps 的拉取请求中显示构建状态

我们如何捕获在 bitbucket 云中创建的拉取请求

测试 npm 包依赖的拉取请求的有效方法

如何通过 Bitbucket 中的拉取请求变基

如何从 GIT 恢复旧的拉取请求

如何在 Azure DevOps 中自动触发构建拉取请求?