Skip to content

Commit 83adeef

Browse files
committed
ci: add check for duplicate target paths / aliases
Signed-off-by: David Karlsson <[email protected]>
1 parent 886a27a commit 83adeef

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ jobs:
5757
- unused-media
5858
- test-go-redirects
5959
- dockerfile-lint
60+
- path-warnings
6061
steps:
6162
-
6263
name: Checkout

Dockerfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,18 @@ set -ex
109109
./scripts/test_unused_media.sh
110110
EOT
111111

112+
# path-warnings checks for duplicate target paths
113+
FROM build-base AS path-warnings
114+
RUN hugo --printPathWarnings > /path-warnings.txt
115+
RUN <<EOT
116+
DUPLICATE_TARGETS=$(grep "Duplicate target paths" /path-warnings.txt)
117+
if [ ! -z "$DUPLICATE_TARGETS" ]; then
118+
echo "$DUPLICATE_TARGETS"
119+
echo "You probably have a duplicate alias defined. Please check your aliases."
120+
exit 1
121+
fi
122+
EOT
123+
112124
# pagefind installs the Pagefind runtime
113125
FROM base AS pagefind
114126
ARG PAGEFIND_VERSION=1.1.0

docker-bake.hcl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ target "release" {
3232
}
3333

3434
group "validate" {
35-
targets = ["lint", "test", "unused-media", "test-go-redirects", "dockerfile-lint"]
35+
targets = ["lint", "test", "unused-media", "test-go-redirects", "dockerfile-lint", "path-warnings"]
3636
}
3737

3838
target "test" {
@@ -63,6 +63,11 @@ target "dockerfile-lint" {
6363
call = "check"
6464
}
6565

66+
target "path-warnings" {
67+
target = "path-warnings"
68+
output = ["type=cacheonly"]
69+
}
70+
6671
#
6772
# releaser targets are defined in _releaser/Dockerfile
6873
# and are used for AWS S3 deployment

0 commit comments

Comments
 (0)