sudo apt install in github action
In one of the project I work on, I use graphviz
for visualization and have test code for this functionality.
But to test the code graphviz
must be installed. I setup CI as the github action.
But I couldn't manage to install graphviz
as the github action.
We have the following yml
name: test
on: push
开发者_高级运维
jobs:
test_coverage:
name: Test Software
runs-on: ubuntu-latest
steps:
# See: https://github.com/actions/checkout
- uses: actions/checkout@v3
- name: Setup Graphviz
run: |
sudo apt-get -y install graphviz
But it fails with
sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper
I am using Github Enterprise, if this means anything. How can I fix such an issue? Thanks.
Check first which users is executing that command:
run: |
id -a
sudo apt-get -y install graphviz
Said user is probably not added to the sudoers.
Yet, the GitHub Actions documentation mentions:
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.
For more information, see the "Sudo Manual."
Check if this works better with:
runs-on: ubuntu-20.04
# or
runs-on: ubuntu-22.04
精彩评论