-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathloop.sh
More file actions
executable file
·38 lines (30 loc) · 1.08 KB
/
Copy pathloop.sh
File metadata and controls
executable file
·38 lines (30 loc) · 1.08 KB
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
#!/usr/bin/env bash
# Optional check for tmux
if [ "$TMUX" == '' ]; then
echo 'Not running inside tmux. Abort.'
exit 1
fi
# Stop execution, if something goes wrong
set -e
# If you changed the default values using command line arguments,
# you should change the values here too.
clone_directory_path='cloned'
lock_directory_path='locks'
qresult_file='qresults'
# Run until undocumented GitHub API limit (max. 20 pages)
for i in {0..19}; do
# Manual garbage collection
rm -rf "$clone_directory_path" "$lock_directory_path" "$qresult_file"
# Save the current page offset for debugging purposes
# The number may be used to continue the loop, if something should crash
echo "$i" > current_page_offset
# $(nproc) + 1 = $(nproc) (or os.cpu_count()) pull requests + default branch
# Query some repositories
./query.py "$qresult_file" \
--repo-page-offset "$i" \
--report-threshold "$(($(nproc) + 1))"
# Run detector
xargs -P "$(nproc)" -I {} \
./detect.py --report-threshold "$(($(nproc) + 1))" \
'{}' < "$qresult_file"
done