Update CI

pull/865/head
Yuta Katayama 12 months ago
parent 70aa6bebff
commit 85ce864ff1
No known key found for this signature in database
GPG Key ID: E50AA6AA7A7BD4CA

@ -0,0 +1,29 @@
#!/bin/bash
filename="/tmp/repos.txt"
output="archived_check_list.txt"
lines_per_chunk=100
grep '](https://github.com' [a-z]*.md | sed -re 's/^.*\]\(https:\/\/github.com\/([^\)]*).*/\1/' > $filename
if [ -e "$output" ]; then
rm "$output"
fi
total_lines=$(wc -l < "$filename")
for ((start=1; start <= total_lines; start += lines_per_chunk)); do
repos=$(tail -n +$start "$filename" | head -n $lines_per_chunk)
query=""
index=1
while IFS= read -r line; do
owner="${line%%/*}"
repo_name="${line#*/}"
query=$query" r$index: repository(name: \"$repo_name\", owner: \"$owner\", followRenames: true) {
isArchived
nameWithOwner
}"
index=$((index+1))
done <<< $repos
# result=$(gh api graphql -f query="query repository { $query }" 2>/dev/null | jq -r '.data[] | .nameWithOwner + ": " + (.isArchived|tostring)')
result=$(gh api graphql -f query="query repository { $query }" 2>/dev/null | jq -r '.data[]|(.isArchived|tostring)')
paste -d ":" <(echo "$repos") <(echo "$result") | tee -a "$output"
done

@ -18,19 +18,17 @@ jobs:
apt update
apt-get install -y gh jq ca-certificates curl
- run: >
grep '](https://github.com' [a-z]*.md |
sed -re 's/^.*\]\(https:\/\/github.com\/([^\)]*).*/\1/' |
xargs -I {} bash -c "echo -n \"{}: \"; gh api repos/{} 2>/dev/null | jq -r '(.archived|tostring)'" | tee archived_check_list.txt
./.github/scripts/archive_check.sh
env:
GH_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
- run: >
grep ": true" archived_check_list.txt || true
grep ":true" archived_check_list.txt | cut -d ":" -f 1 | sed 's/^/https:\/\/github.com\//'
- run: >
test $(grep ': true' archived_check_list.txt | wc -l) -le 0
test $(grep ':true' archived_check_list.txt | wc -l) -le 0
- run: >
grep ": null" archived_check_list.txt || true
grep ":null" archived_check_list.txt | cut -d ":" -f 1 | sed 's/^/https:\/\/github.com\//'
- run: >
test $(grep ': null' archived_check_list.txt | wc -l) -le 0
test $(grep ':null' archived_check_list.txt | wc -l) -le 0
# curl 429 too many requests
# - run: >
# grep '](https://github.com' README.md [a-z]*.md |

Loading…
Cancel
Save