3

我试图npm run ci-test在 github 操作工作流中运行 npm 命令,但出现以下错误:

> some-repo@0.1.0 ci-test /home/runner/work/some-repo/some-repo
> NODE_ENV=test jest --forceExit

npm verb lifecycle some-repo@0.1.0~ci-test: unsafe-perm in lifecycle true

ci.yml

name: CI

on:
  push:
    branches: [ ci ]

jobs:
  test:
    runs-on: ubuntu-latest
    services:
      mysql:
        image: mysql:8.0
        env:
          MYSQL_ROOT_PASSWORD: password
          MYSQL_DATABASE: somedb
        ports:
            - '3306:3306'
        options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
    steps:
    - uses: actions/checkout@v2
      with:
        persist-credentials: false
    - name: Use Node.js
      uses: actions/setup-node@v1
      with:
        node-version: '12.x'
    - run: mysql -h 127.0.0.1 --port 3306 -u root -ppassword -e 'CREATE DATABASE IF NOT EXISTS somedb;'
    - run: node --version
    - run: npm install
    - run: npm run ci-test --loglevel verbose
      env:
        DATABASE_HOST: 127.0.0.1
        DATABASE_USER: root
        DATABASE_PASSWORD: password
        DATABASE_DATABASE: some-b
        DATABASE_DIALECT: mysql
        DATABASE_LOGGER: true
        PORT: 8080

包.json

...
    "ci-test": "NODE_ENV=test jest --forceExit",
...
4

0 回答 0