Skip to content

Commit

Permalink
Harden behavior if sudo is installed or not
Browse files Browse the repository at this point in the history
  • Loading branch information
christophfroehlich committed Apr 23, 2024
1 parent 944b6ba commit 1df3c24
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/reusable-build-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ jobs:
- name: "Determine prerequisites"
id: prereq
run: |
DEBIAN_FRONTEND=noninteractive apt update && apt upgrade -y
apt install -y sudo apt-utils
command -v sudo >/dev/null 2>&1 || (apt update && apt install -y sudo)
DEBIAN_FRONTEND=noninteractive sudo apt update && sudo apt upgrade -y
echo "need_node=$(command -v node >/dev/null 2>&1 && echo 0 || echo 1)" >> $GITHUB_OUTPUT
# needed for github actions, and only if a bare ubuntu image is used
Expand All @@ -38,7 +38,7 @@ jobs:
# https://github.com/nektos/act/issues/973
if: ${{ steps.prereq.outputs.need_node == '1' && env.ACT }}
run: |
apt install -y curl
sudo apt install -y curl
curl -sS https://webi.sh/node | sh
echo ~/.local/opt/node/bin >> $GITHUB_PATH
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/reusable-pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ jobs:
- name: "Determine prerequisites"
id: prereq
run: |
DEBIAN_FRONTEND=noninteractive apt update && apt upgrade -y
apt install -y sudo apt-utils
command -v sudo >/dev/null 2>&1 || (apt update && apt install -y sudo)
DEBIAN_FRONTEND=noninteractive sudo apt update && sudo apt upgrade -y
echo "need_node=$(command -v node >/dev/null 2>&1 && echo 0 || echo 1)" >> $GITHUB_OUTPUT
# needed for github actions, and only if a bare ubuntu image is used
Expand All @@ -43,7 +43,7 @@ jobs:
# https://github.com/nektos/act/issues/973
if: ${{ steps.prereq.outputs.need_node == '1' && env.ACT }}
run: |
apt install -y curl
sudo apt install -y curl
curl -sS https://webi.sh/node | sh
echo ~/.local/opt/node/bin >> $GITHUB_PATH
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/reusable-ros-tooling-source-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ jobs:
- name: "Determine prerequisites"
id: prereq
run: |
DEBIAN_FRONTEND=noninteractive apt update && apt upgrade -y
apt install -y sudo apt-utils
command -v sudo >/dev/null 2>&1 || (apt update && apt install -y sudo)
DEBIAN_FRONTEND=noninteractive sudo apt update && sudo apt upgrade -y
echo "need_node=$(command -v node >/dev/null 2>&1 && echo 0 || echo 1)" >> $GITHUB_OUTPUT
# needed for github actions, and only if a bare ubuntu image is used
Expand All @@ -53,7 +53,7 @@ jobs:
# https://github.com/nektos/act/issues/973
if: ${{ steps.prereq.outputs.need_node == '1' && env.ACT }}
run: |
apt install -y curl
sudo apt install -y curl
curl -sS https://webi.sh/node | sh
echo ~/.local/opt/node/bin >> $GITHUB_PATH
Expand Down

0 comments on commit 1df3c24

Please sign in to comment.