Skip to content

Commit 1e1345d

Browse files
authored
CI: Use pre-commit from apt repositories instead of pip (#177)
pre-commit is available as an APT package starting with Ubuntu 22.04. This commit avoids the following error: WARNING: The directory '/github/home/.cache/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you should use sudo's -H flag. error: externally-managed-environment x This environment is externally managed --> To install Python packages system-wide, try apt install python3-xyz, where xyz is the package you are trying to install. If you wish to install a non-Debian-packaged Python package, create a virtual environment using python3 -m venv path/to/venv. Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make sure you have python3-full installed. If you wish to install a non-Debian packaged Python application, it may be easiest to use pipx install xyz, which will manage a virtual environment for you. Make sure you have pipx installed. See /usr/share/doc/python3.12/README.venv for more information. note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages. hint: See PEP 668 for the detailed specification.
1 parent f0c93be commit 1e1345d

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

.github/workflows/github-actions.yml

+1-3
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@ jobs:
1313
- name: Install apt dependencies
1414
run: |
1515
apt-get update
16-
apt-get install -y build-essential clang-format file git python3-pip python3-colcon-common-extensions python3-rosdep
17-
- name: Install pip dependencies
18-
run: pip install pre-commit
16+
apt-get install -y build-essential clang-format file git python3-pip python3-colcon-common-extensions python3-rosdep pre-commit
1917
- name: Checkout repository
2018
uses: actions/checkout@v3
2119
with:

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -174,10 +174,10 @@ pre-commit Formatting Checks
174174

175175
This repo has a [pre-commit](https://pre-commit.com/) check that runs in CI.
176176
You can use this locally and set it up to run automatically before you commit
177-
something. To install, use pip:
177+
something. To install, use apt:
178178

179179
```bash
180-
pip3 install --user pre-commit
180+
sudo apt install pre-commit
181181
```
182182

183183
To run over all the files in the repo manually:

0 commit comments

Comments
 (0)