gpt4 book ai didi

github - 新的 GitHub 操作在空文件夹中运行

转载 作者:行者123 更新时间:2023-12-03 03:38:12 27 4
gpt4 key购买 nike

我正在使用新的 GitHub 操作,下面的工作流程的想法是在打开或同步 pr 时运行,它应该首先检查并安装依赖项,然后运行一些 yarn 脚本

name: PR to Master
on:
pull_request:
branches:
- master
jobs:
# Synchronize or Opened
synchronized_or_opened:
name: Synchronize or Opened
runs-on: ubuntu-latest
steps:
- uses: actions/bin/filter@master
with:
args: action 'opened|synchronize'
# Add Labels
add_labels:
name: Add Labels
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
needs: synchronized_or_opened
# Checkout
checkout:
name: Checkout
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
needs: synchronized_or_opened
# Install Dependencies
install_dependencies:
name: Install Dependencies
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [10.x]
steps:
- run: yarn dep:install-npm
needs: checkout
# Typecheck
typecheck:
name: Typecheck
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [10.x]
steps:
- run: yarn typecheck
needs: install_dependencies
# Prettier
prettier:
name: Prettier
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [10.x]
steps:
- run: yarn prettier
needs: install_dependencies
# ESLint
eslint:
name: ESlint
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [10.x]
steps:
- run: yarn eslint
needs: install_dependencies
# Danger
danger:
name: Danger
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [10.x]
steps:
- run: yarn danger
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
needs: install_dependencies

目前它成功进入结账阶段,但是一旦运行安装作业,我就会收到以下错误

error Couldn't find a package.json file in "/home/runner/work/myRepo/myRepo"

根据这次结帐判断,要么失败,要么我位于错误的文件夹中?

最佳答案

Workflow syntax docs 中所述:

Each job runs in a fresh instance of the virtual environment specified by runs-on.

据我所知,您正在与其他人完全独立的工作中执行结帐步骤。这样做不会以任何方式影响其他工作。它实际上应该在执行 npm CLI 命令的作业中定义。

以下是您的一项工作的示例:

jobs:
# (...) Other jobs
# Install Dependencies
install_dependencies:
name: Install Dependencies
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [10.x]
steps:
- uses: actions/checkout@master
- run: yarn dep:install-npm
needs: checkout
# (...) Other jobs

GitHub starter workflow templates中有一些通用的例子.

关于github - 新的 GitHub 操作在空文件夹中运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57509118/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com