Skip to content

Commit 27e2921

Browse files
committed
Check new versions in redirected repositories
1 parent cd3a70a commit 27e2921

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+42
-13
lines changed

β€ŽMakefileβ€Ž

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ $(1): $(1).yml
1717
echo "πŸ“„ Using existing $(1).html and assets"; \
1818
fi
1919

20-
force-build-$(1): clean-$(1) build-$(1) organize-$(1) mark-changed
20+
force-build-$(1): clean-$(1) build-$(1) organize-$(1) update-cache-$(1) mark-changed
2121

2222
clean-$(1):
2323
@echo "🧹 Cleaning old files for $(1)..."
@@ -45,6 +45,36 @@ $(foreach course,$(COURSES),$(eval $(call build_course,$(course))))
4545
mark-changed:
4646
@touch .cache/build_occurred
4747

48+
update-cache-%:
49+
@YAML_HASH=$$(sha256sum $*.yml 2>/dev/null | cut -d' ' -f1 || echo "missing"); \
50+
case "$*" in \
51+
"digitalesysteme") REPO_NAME="EingebetteteSysteme" ;; \
52+
"prozprog") REPO_NAME="ProzeduraleProgrammierung" ;; \
53+
"softwareentwicklung") REPO_NAME="Softwareentwicklung" ;; \
54+
"robotikprojekt") REPO_NAME="Robotikprojekt" ;; \
55+
"index") REPO_NAME="" ;; \
56+
*) REPO_NAME="" ;; \
57+
esac; \
58+
if [ -n "$$REPO_NAME" ]; then \
59+
API_URL="https://api.github.com/repos/TUBAF-IfI-LiaScript/VL_$${REPO_NAME}/commits/master"; \
60+
API_RESPONSE=$$(curl -sL --connect-timeout 10 "$$API_URL" 2>/dev/null); \
61+
if command -v jq >/dev/null 2>&1; then \
62+
REMOTE_HASH=$$(echo "$$API_RESPONSE" | jq -r '.sha' 2>/dev/null || echo "unreachable"); \
63+
else \
64+
REMOTE_HASH=$$(echo "$$API_RESPONSE" | sed -n 's/.*"sha":"\([^"]*\)".*/\1/p' | head -1); \
65+
if [ -z "$$REMOTE_HASH" ]; then REMOTE_HASH="unreachable"; fi; \
66+
fi; \
67+
if [ "$$REMOTE_HASH" = "unreachable" ] || [ -z "$$REMOTE_HASH" ]; then \
68+
REMOTE_HASH="unreachable"; \
69+
fi; \
70+
else \
71+
REMOTE_HASH="no-remote"; \
72+
fi; \
73+
mkdir -p .cache; \
74+
echo "$$YAML_HASH" > ".cache/$*"; \
75+
echo "$$REMOTE_HASH" >> ".cache/$*"; \
76+
echo "πŸ“ Cache updated for $*"
77+
4878
git-update-if-needed:
4979
@if [ -f .cache/build_occurred ]; then \
5080
echo "πŸ”„ Changes detected - updating git repository..."; \
-20.9 KB
Binary file not shown.
9 Bytes
Binary file not shown.
53.8 KB
Binary file not shown.
-28.1 KB
Binary file not shown.
-56.2 KB
Binary file not shown.
1.63 KB
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

0 commit comments

Comments
Β (0)