【发布时间】:2021-03-14 23:01:48
【问题描述】:
我正在尝试设置一个 github 操作机器人,它在操作运行时使用复合来构建。值得注意的是,这不是必需的,我知道 ncc 也可以实现相同的目标,但我很好奇是否有可能以可持续的方式进行这项工作。
在某些情况下,我正在尝试使用 yaml 脚本运行我的 alita-moore/EIP-Bot 私人操作...
name: "Auto Merge EIP"
description: "A bot that lints EIP edits, finds common errors, and can auto-merge"
inputs:
GITHUB-TOKEN:
description: |-
The Github token to be used by this bot when merging, posting comments, or requesting reviewers
required: true
VERSION:
description: version of the action; this is required because of how actions work
required: true
runs:
using: "composite"
steps:
- run: cd /home/runner/work/_actions/alita-moore/EIP-Bot/${{ inputs.VERSION }} && npm ci && npm run build && GITHUB_TOKEN=${{ inputs.GITHUB-TOKEN }} node build/index.js
shell: bash
这目前在给定 repo 的工作流 yaml 下运行
on: [pull_request]
jobs:
auto_merge_bot:
runs-on: ubuntu-latest
name: EIP Auto-Merge Bot
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Node.js Enviornment
uses: actions/setup-node@v2
with:
node-version: '14'
- name: auto-merge-bot
uses: alita-moore/EIP-Bot@1.0.8
id: auto-merge-bot
with:
GITHUB-TOKEN: ${{ secrets.TOKEN }}
VERSION: 1.0.8
您可能已经注意到,在npm ci && npm run build 之前,我首先必须cd /home/runner/work/_actions/alita-moore/EIP-Bot/${{ inputs.VERSION }}
如果你不这样做,它会抛出以下错误
Run alita-moore/EIP-Bot@1.0.1
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /home/runner/work/EIPs/EIPs/package.json
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, open '/home/runner/work/EIPs/EIPs/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! /home/runner/.npm/_logs/2021-03-14T09_02_26_002Z-debug.log
Error: Process completed with exit code 254.
有没有更好的方法来做到这一点?
【问题讨论】:
标签: github-actions