ubuntu - 须藤 : no tty present and no askpass program specified in github actions

标签 ubuntu github yaml github-actions apt-get

嘿,所以我有这个 github 操作来保存 package-lock 和 package.json 文件,如下所示:

# workflow that generates the package files for my webapp :)

name: generate-package-files

# Controls when the action will run.
on:
  # Allows you to run this workflow manually from the Actions tab
  workflow_dispatch:
    inputs:
      myWebappBranch:
        description: 'my webapp branch'
        required: true
        default: 'someBranch'
      packageRepos:
        description: 'repos built out for the job.'
        required: true
        default: aPackage

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
  # This workflow contains a single job called "build"
  generate_files:
    # The type of runner that the job will run on
    runs-on: ubuntu-latest

    strategy:
      matrix:
        node-version: [14.x]

    # Steps represent a sequence of tasks that will be executed as part of the job
    steps:

      #set up node js
      - uses: actions/checkout@v2
      - name: Use Node.js ${{ matrix.node-version }}
        uses: actions/setup-node@v2
        with:
          node-version: ${{ matrix.node-version }}

      - name: Install build essentials
        run: sudo apt-get -y install build-essential

      #sets up SSH so we can checkout the needed repos.
      - name: Setup SSH
        uses: webfactory/ssh-agent@v0.5.3
        with:
          ssh-private-key: ${{ secrets.BITBUCKET_SSH_KEY }}

      - name: Check out the webapp for building and make sure it exists first.
        run: (test -d my-app) || git clone git@bitbucket.org:my-repo/my-webapp.git

      # Runs a set of commands using the runners shell
      - name: build package files
        working-directory: my-webapp
        run: |
          git checkout ${{ github.event.inputs.myWebappBranch }}
          git pull
          npm ci
          npm install ${{ github.event.inputs.packageRepos }}

      - name: save files
        uses: actions/upload-artifact@v2
        with:
          name: package-lock
          path: package*
似乎没问题,不幸的是,当我运行它时,我得到:
Run sudo apt-get -y install build-essential
sudo: no tty present and no askpass program specified
Error: Process completed with exit code 1.
我不太确定我做错了什么。当我四处搜索时,安装的语法应该可以工作,从我所看到的:
https://code-maven.com/slides/github-ci/install-packages-on-ubuntu-linux-in-github-actions

https://docs.github.com/en/actions/using-github-hosted-runners/customizing-github-hosted-runners#installing-software-on-ubuntu-runners
这似乎是正确的解决方案。我已尝试编辑 sudoers 文件,但访问被拒绝。任何帮助都是极好的! :)

最佳答案

为此,您需要允许使用没有密码的 sudo。sudo如果它尝试提示输入密码但不能,则打印此错误消息。

关于ubuntu - 须藤 : no tty present and no askpass program specified in github actions,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68929811/

相关文章:

python - 在 Windows 上使用 pip 从 GitHub 安装时出错

git - 如何通过命令行压缩和 merge Pull Request 与 GPG 签名?

python - 将 json 转储到 yaml

go - 如果我不知道使用 go 的(结构)中的预期模式,如何验证/读取 yaml?

linux - 如何在 Ubuntu 或 Pop OS 中通过右键单击添加 "Open with Code"?

android - 无法通过 Ubuntu 终端构建 Android Studio 项目

php - ubuntu 包管理器无法识别 php5

c - 尝试读取 json 文件时出现段错误

git - github 是否记得提交 ID?

docker-compose - yaml 中带引号和不带引号的字符串之间有什么区别(如果有)?