-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
51 lines (42 loc) · 1.72 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
.DEFAULT_GOAL := help
ENV_PREFIX ?= ./
ENV_FILE := $(wildcard $(ENV_PREFIX)/.env)
ifeq ($(strip $(ENV_FILE)),)
$(info $(ENV_PREFIX)/.env file not found, skipping inclusion)
else
include $(ENV_PREFIX)/.env
export
endif
##@ Utility
help: ## Display this help. (Default)
# based on "https://gist.github.com/prwhite/8168133?permalink_comment_id=4260260#gistcomment-4260260"
@grep -hE '^[A-Za-z0-9_ \-]*?:.*##.*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
##@ Utility
help_sort: ## Display alphabetized version of help.
@grep -hE '^[A-Za-z0-9_ \-]*?:.*##.*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
#-------------
# system / dev
#-------------
install_direnv: ## Install direnv to `/usr/local/bin`. Check script before execution: https://direnv.net/ .
@which direnv > /dev/null || \
(curl -sfL https://direnv.net/install.sh | bash && \
sudo install -c -m 0755 direnv /usr/local/bin && \
rm -f ./direnv)
@echo "see https://direnv.net/docs/hook.html"
install_just: ## Install just. Check script before execution: https://just.systems/ .
@which cargo > /dev/null || (curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh)
@cargo install just
env_print: ## Print a subset of environment variables defined in ".envrc" file.
env | grep "TF_VAR\|GITHUB\|GH_\|GCP_\|MLFLOW" | sort
approve_prs: ## Approve github pull requests from bots: PR_ENTRIES="2-5 10 12-18"
for entry in $(PR_ENTRIES); do \
if [[ "$$entry" == *-* ]]; then \
start=$${entry%-*}; \
end=$${entry#*-}; \
for pr in $$(seq $$start $$end); do \
@gh pr review $$pr --approve; \
done; \
else \
@gh pr review $$entry --approve; \
fi; \
done