gpt4 book ai didi

github-actions - 如何在 GitHub Actions 工作流程中进行 apt-get install?

转载 作者:行者123 更新时间:2023-12-01 23:23:23 25 4
gpt4 key购买 nike

在新的 GitHub 操作中,我尝试安装一个包,以便在后续步骤之一中使用它。

name: CI

on: [push, pull_request]

jobs:
translations:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
with:
fetch-depth: 1
- name: Install xmllint
run: apt-get install libxml2-utils
# ...
然而这失败了
Run apt-get install libxml2-utils
apt-get install libxml2-utils
shell: /bin/bash -e {0}
E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?
##[error]Process completed with exit code 100.
做到这一点的最佳方法是什么?我需要接触 Docker 吗?

最佳答案

docs说:

The Linux and macOS virtual machines both run using passwordless sudo. When you need to execute commands or install tools that require more privileges than the current user, you can use sudo without needing to provide a password.



因此,只需执行以下操作即可:
- name: Install xmllint
run: sudo apt-get install libxml2-utils

关于github-actions - 如何在 GitHub Actions 工作流程中进行 apt-get install?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57982945/

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