-
Notifications
You must be signed in to change notification settings - Fork 1
43 lines (36 loc) · 1.08 KB
/
submodules-link-check.yml
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
name: Check Broken Submodules Links
on:
pull_request:
types:
- opened
- synchronize
- reopened
merge_group:
jobs:
check-links:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
submodules: true
- name: Find and Check Linux File Links
run: |
# Create a temporary file to store broken links
tmpfile=$(mktemp)
# Find all symbolic links in the repository and check if they are broken
find . -type l -not -path './submodules/*' | while read -r link; do
if [ ! -e "$link" ]; then
echo "$link" >> "$tmpfile"
fi
done
# Check if there are broken links and print them
if [ -s "$tmpfile" ]; then
echo "Broken links found:"
cat "$tmpfile"
exit 1 # Set a non-zero exit code to mark the workflow as failed
else
echo "No broken links found."
fi
# Clean up the temporary file
rm "$tmpfile"