Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Github rate limit check #275

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -512,11 +512,20 @@ set_admin_password:
# Hot fix section. These are not meant to be run normally but are meant to be run when needed.

LATEST_VERSION := $(shell curl -s https://api.github.com/repos/desandro/masonry/releases/latest | grep '\"tag_name\":' | sed -E 's/.*\"([^\"]+)\".*/\1/')
GITHUB_LIMIT := $(shell curl -I https://api.github.com/users/octocat | grep "x-ratelimit-reset: " | sed "s/x-ratelimit-reset: //")

.PHONY: fix-masonry
.SILENT: fix-masonry
## Fix missing masonry library.
fix-masonry:
# If ${LATEST_VERSION} is empty, we're on a dev branch.
if [ ! "${LATEST_VERSION}" ]; then \
echo ""; \
echo "Github API rate limit exceeded. Skipping masonry fix." ; \
echo " Either log into Github via the terminal or wait until $(shell date --date='@${GITHUB_LIMIT}') for the rate limit to reset." ; \
echo "" ; \
exit 1 ; \
fi
@echo "Latest version of masonry library is ${LATEST_VERSION}"
docker-compose exec drupal bash -lc "[ -d '/var/www/drupal/web/libraries' ] && exit ; mkdir -p /var/www/drupal/web/libraries ; chmod 755 /var/www/drupal/web/libraries ; chown 1000:nginx /var/www/drupal/web/libraries"
docker-compose exec drupal bash -lc "cd /var/www/drupal/web/libraries/ ; [ ! -d '/var/www/drupal/web/libraries/masonry' ] && git clone --quiet --branch ${LATEST_VERSION} https://github.com/desandro/masonry.git || echo Ready"
Expand Down