Skip to content

Commit cf021ee

Browse files
authored
Check url of docker image list. (#472)
Signed-off-by: zepan <ze.pan@intel.com>
1 parent 70a50d8 commit cf021ee

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Copyright (C) 2024 Intel Corporation
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
name: Check the validity of links in docker_images_list.
5+
6+
on:
7+
push:
8+
branches: [main]
9+
types: [opened, reopened, ready_for_review, synchronize]
10+
11+
jobs:
12+
check-dockerfile-paths:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Clean Up Working Directory
17+
run: sudo rm -rf ${{github.workspace}}/*
18+
19+
- name: Checkout repo GenAIExamples
20+
uses: actions/checkout@v4
21+
22+
- name: Check the validity of links
23+
run: |
24+
cd ${{github.workspace}}
25+
miss="FALSE"
26+
while IFS=: read -r line link; do
27+
http_status=$(curl -o /dev/null -s -w "%{http_code}" "$link")
28+
if [ "$http_status" -eq 200 ]; then
29+
echo "Valid link: $link (Line $line)"
30+
else
31+
echo "Broken link: $link (Line $line) (Status $http_status) "
32+
echo "-----------------retry strat----------------------"
33+
retry_http_status=$(curl -o /dev/null -s -w "%{http_code}" "$link")
34+
if [ "$retry_http_status" -eq 200 ]; then
35+
miss="FALSE"
36+
echo "Valid link: $link (Line $line)"
37+
echo "---------------Retry is valid---------------------"
38+
else
39+
miss="TRUE"
40+
echo "Retry broken link: $link (Line $line) (Status $http_status) "
41+
echo "-------------Retry is not valid-------------------"
42+
fi
43+
fi
44+
done < <(grep -n -oP '(?<=a href=")[^"]*(?=">)' ../../docker_images_list.md)
45+
46+
if [[ "$miss" == "TRUE" ]]; then
47+
exit 1
48+
fi
49+
shell: bash

0 commit comments

Comments
 (0)