Skip to content

Openverse is a search engine for openly-licensed media. This monorepo includes all application code.

Upgrade pre-commit installation

Dhruv Bhanushalie8a61822d4bd
diff --git a/justfile b/justfile
index 1a178f587..452e85536 100644
--- a/justfile
+++ b/justfile
@@ -108,16 +108,27 @@ precommit:
#!/usr/bin/env bash
set -eo pipefail
if [ -z "$SKIP_PRE_COMMIT" ] && [ ! -f ./pre-commit.pyz ]; then
- echo "Downloading pre-commit";
+ echo "Downloading pre-commit"
+ URL=$(
+ curl \
+ --fail \
+ --silent `# silence error raised by grep closing the pipe early` \
+ ${GITHUB_TOKEN:+ --header "Authorization: Bearer ${GITHUB_TOKEN}"} \
+ https://api.github.com/repos/pre-commit/pre-commit/releases/latest |
+ grep -o 'https://.*\.pyz' -m 1
+ )
+ echo "Download URL: $URL"
curl \
- https://api.github.com/repos/pre-commit/pre-commit/releases/latest \
- | grep -o 'https://.*\.pyz' -m 1 \
- | xargs \
- | xargs curl -fsJo pre-commit.pyz -L;
- echo "Installing pre-commit";
- python3 pre-commit.pyz install -t pre-push -t pre-commit;
+ --fail \
+ --location `# follow redirects, else cURL outputs a blank file` \
+ --output pre-commit.pyz \
+ ${GITHUB_TOKEN:+ --header "Authorization: Bearer ${GITHUB_TOKEN}"} \
+ "$URL"
+ echo "Installing pre-commit"
+ python3 pre-commit.pyz install -t pre-push -t pre-commit
+ echo "Done"
else
- echo "Skipping pre-commit installation";
+ echo "Skipping pre-commit installation"
fi
# Run pre-commit to lint and reformat all files