-
Notifications
You must be signed in to change notification settings - Fork 0
87 lines (73 loc) · 3.5 KB
/
index-update.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
name: Index-update
on:
workflow_dispatch:
push:
branches:
- 'master'
repository_dispatch:
types: [index_update]
schedule:
- cron: '0 2 * * *'
jobs:
docs:
name: "Index-update"
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@master
- name: Configure git and environment variables
run: |
# Configure git
git config --global push.default upstream
git config --global user.name "GitHub Actions"
git config --global user.email "[email protected]"
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git
#git clone http://gitub.com/robotology/.github
- name: Get the repo list
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Get list of all devices repositories
gh repo list robotology -L 1000 --source --visibility public > robotology-repos-list-complete.txt
grep -v ".github" robotology-repos-list-complete.txt > tmpfile && mv tmpfile robotology-repos-list-complete.txt
sort robotology-repos-list-complete.txt > tmpfile && mv tmpfile robotology-repos-list-complete.txt
cat robotology-repos-list-complete.txt | cut --complement -f 3 > tmpfile && mv tmpfile robotology-repos-list-complete.txt
cat robotology-repos-list-complete.txt | cut -f 1 > robotology-repos-list-short.txt
echo "Found the following repositories:"
cat robotology-repos-list-short.txt
echo "Found the following repositories (complete info):"
cat robotology-repos-list-complete.txt
touch table.md
#echo "| Name | Description | Last commit | CI status |" >> table.md
#echo "| ----------- | ----------- | ----------- | ----------- |" >> table.md
echo "| Name | Description | CI status |" >> table.md
echo "| ----------- | ----------- | ----------- |" >> table.md
while IFS='' read line; do
entryName=$(echo "$line" | cut -f 1 )
entryNameNoOrg=$(echo "$line" | cut -f 1 | sed 's/.*\///')
descName=$(echo "$line" | cut -f 2 )
dateComm=$(echo "$line" | cut -f 3 )
if wget --spider "https://github.com/$entryName/workflows/CI%20Workflow/badge.svg" 2>/dev/null; then
CIstatus="[![Build Status](https://github.com/$entryName/workflows/CI%20Workflow/badge.svg)](https://github.com/$entryName/actions?query=workflow%3A%22CI+Workflow%22)"
else
CIstatus=""
fi
#echo "| [$entryNameNoOrg](https://github.com/$entryName) | $descName| $dateComm | $CIstatus|" >> table.md
echo "| [$entryNameNoOrg](https://github.com/$entryName) | $descName| $CIstatus|" >> table.md
done < robotology-repos-list-complete.txt
cat table.md
- name: Commit and push
run: |
cp profile/README_base.md profile/README_with_list.md
cat table.md >> profile/README_with_list.md
if ! cmp profile/README_with_list.md profile/README.md >/dev/null 2>&1
then
echo "Index changed, README.md will be updated with:"
cp profile/README_with_list.md profile/README.md
cat profile/README.md
git add profile/README.md
git commit -m "update README.md"
git push origin main
else
echo "Index is ok, no actions required"
fi