Skip to content

Commit eca0115

Browse files
fixed makefile which pinned old issue (#149)
* fixed makefile which pinned old issue * implemented all copilot feedback * Modify Makefile to sync with origin/main Updated git commands to remove hard reset.
1 parent f164a2d commit eca0115

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

Makefile

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,8 @@
1717

1818
IMAGE_NAME = df-site-build
1919
REPO_NAME = infrastructure-actions
20-
COMMIT_HASH = 8aee7a080268198548d8d1b4f1315a4fb94bffea
2120

22-
.PHONY: clone-repo checkout-commit build-image build
21+
.PHONY: clone-repo sync-repo build-image build
2322

2423
all: build
2524

@@ -32,15 +31,17 @@ clone-repo:
3231
echo "$(REPO_NAME) already exists, skipping clone."; \
3332
fi
3433

35-
# checks out the specific commit due to https://github.com/apache/infrastructure-actions/issues/218
36-
checkout-commit: clone-repo
34+
# syncs the repository with the latest changes from the main branch
35+
sync-repo: clone-repo
3736
@cd $(REPO_NAME) && \
38-
if [ "$$(git rev-parse HEAD)" = "$(COMMIT_HASH)" ]; then \
39-
echo "Repository is already at commit $(COMMIT_HASH), skipping checkout."; \
40-
else \
41-
echo "Checking out commit $(COMMIT_HASH)..."; \
42-
git fetch --depth 1 origin $(COMMIT_HASH) && git checkout $(COMMIT_HASH); \
43-
fi
37+
if [ -n "$$(git status --porcelain)" ]; then \
38+
echo "Error: Repository has uncommitted changes. Please clean the repository first."; \
39+
exit 1; \
40+
fi; \
41+
echo "Syncing with origin/main..."; \
42+
git fetch origin main && \
43+
git checkout main
44+
4445

4546
# builds the Docker image with pelicanasf installed
4647
build-image:
@@ -52,6 +53,6 @@ build-image:
5253
fi
5354

5455
# runs the Docker container to build the site
55-
build: checkout-commit build-image
56+
build: sync-repo build-image
5657
docker run -it --rm -p8000:8000 -v $(PWD):/site --entrypoint /bin/bash $(IMAGE_NAME) -c \
5758
"pelicanasf content -o blog && python3 -m http.server 8000"

0 commit comments

Comments
 (0)