Skip to content

Commit 218c6b3

Browse files
author
Daniel Gorski
committed
showcase
0 parents  commit 218c6b3

File tree

8 files changed

+320
-0
lines changed

8 files changed

+320
-0
lines changed

.github/workflows/update-readme.yml

+139
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
name: Update README with Table
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch: # Allows manual triggering of the workflow
8+
9+
jobs:
10+
update-readme:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout repository
15+
uses: actions/checkout@v2
16+
17+
- name: Set up Node.js
18+
uses: actions/setup-node@v2
19+
with:
20+
node-version: '14'
21+
22+
- name: Generate repository folder information
23+
id: generate_table
24+
run: |
25+
# Set the starting "from" value at 50000 and maximum at 99999
26+
START_FROM=50000
27+
MAX_TO=99999
28+
29+
# Create an empty array to store the rows
30+
ROWS=()
31+
32+
# Generate and sort rows on the fly
33+
mapfile -t SORTED_ROWS < <(
34+
find . -maxdepth 2 -type f -name "app.json" -exec dirname {} \; | while IFS= read -r folder; do
35+
# Extract "from", "to", and "name" values from app.json
36+
FROM=$(grep -m 1 '"from":' "$folder/app.json" | sed 's/[^0-9]*//g')
37+
TO=$(grep -m 1 '"to":' "$folder/app.json" | sed 's/[^0-9]*//g')
38+
NAME=$(grep -m 1 '"name":' "$folder/app.json" | sed 's/.*"name": "\(.*\)".*/\1/')
39+
40+
if [ "$FROM" ] && [ "$TO" ] && [ "$NAME" ]; then
41+
# Print each row for sorting
42+
echo "$FROM:$TO:$NAME"
43+
fi
44+
done | sort -t':' -k1,1n
45+
)
46+
47+
# Start building the table, keeping track of gaps
48+
TABLE="| App | From | To |\n|------------------------------------|--------|--------|"
49+
50+
# Initialize the previous "to" to the starting point 50000
51+
PREV_TO=$((START_FROM - 1))
52+
53+
for row in "${SORTED_ROWS[@]}"; do
54+
FROM=$(echo "$row" | cut -d':' -f1)
55+
TO=$(echo "$row" | cut -d':' -f2)
56+
NAME=$(echo "$row" | cut -d':' -f3)
57+
58+
# Check if there is a gap between the previous "to" and current "from"
59+
if [ "$PREV_TO" -lt "$((FROM - 1))" ]; then
60+
GAP_FROM=$((PREV_TO + 1))
61+
GAP_TO=$((FROM - 1))
62+
# Add an empty row for the gap
63+
TABLE+="\n| (empty) | $GAP_FROM | $GAP_TO |"
64+
fi
65+
66+
# Add the current row
67+
TABLE+="\n| $NAME | $FROM | $TO |"
68+
69+
# Update PREV_TO
70+
PREV_TO=$TO
71+
done
72+
73+
# Check if there's a gap between the last "to" and the maximum (99999)
74+
if [ "$PREV_TO" -lt "$MAX_TO" ]; then
75+
GAP_FROM=$((PREV_TO + 1))
76+
GAP_TO=$MAX_TO
77+
TABLE+="\n| (empty) | $GAP_FROM | $GAP_TO |"
78+
fi
79+
80+
# Write the table to table.md
81+
echo -e "$TABLE" > table.md
82+
cat table.md
83+
shell: bash
84+
85+
- name: Create README.md if not exists
86+
run: |
87+
if [ ! -f README.md ]; then
88+
# Use echo -e to interpret \n as new lines
89+
echo -e "# This project contains several PTE modules." > README.md
90+
fi
91+
92+
- name: Update README.md with placeholder
93+
run: |
94+
# Log the current state of README.md for troubleshooting
95+
echo "Current README.md before update:"
96+
cat README.md
97+
98+
# Remove the old table (from start_table comment to end_table comment) and insert placeholder
99+
sed -i '/\[comment\]: <> (start_table)/,/\[comment\]: <> (end_table)/c [TABLE_PLACEHOLDER]' README.md
100+
101+
# Verify if the placeholder has been inserted
102+
echo "README.md after inserting placeholder:"
103+
cat README.md
104+
105+
# Insert the new table with the start and end comments around the placeholder
106+
sed -i '/\[TABLE_PLACEHOLDER\]/{
107+
a [comment]: <> (start_table)\n
108+
r table.md
109+
a \\
110+
a [comment]: <> (end_table)
111+
d
112+
}' README.md
113+
114+
# Log the updated README.md to check if changes are made
115+
echo "README.md after updating table:"
116+
cat README.md
117+
118+
# Forcefully stage README.md for commit
119+
git add README.md
120+
git diff --cached
121+
122+
# Check if any changes have been made
123+
git status
124+
125+
- name: Check if README.md has changed
126+
id: check_diff
127+
run: |
128+
# Check if README.md has changes
129+
git diff --exit-code README.md || echo "README.md has been modified"
130+
131+
- name: Commit and push changes if README.md has changed
132+
if: steps.check_diff.outcome == 'success'
133+
run: |
134+
git config --local user.email "github-actions[bot]@users.noreply.github.com"
135+
git config --local user.name "GitHub Actions Bot"
136+
git commit -m "Update README.md with generated table" || echo "No changes to commit"
137+
git push || echo "Nothing to push"
138+
env:
139+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

App 1/app.json

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"id": "081a1024-e8d2-4ede-9298-f36f3dd0afd0",
3+
"name": "App 1",
4+
"publisher": "BEYONDIT GmbH",
5+
"version": "2024.10.0.0",
6+
"brief": "App 1",
7+
"description": "App 1",
8+
"privacyStatement": "https://beyondit.gmbh/datenschutz",
9+
"EULA": "https://www.beyondit.gmbh/agb",
10+
"help": "http://docs.beyond365.de/",
11+
"contextSensitiveHelpUrl": "http://docs.beyond365.de/",
12+
"url": "https://beyondit.gmbh",
13+
"logo": "app.png",
14+
"dependencies": [],
15+
"screenshots": [],
16+
"platform": "22.0.0.0",
17+
"application": "22.0.0.0",
18+
"idRanges": [
19+
{
20+
"from": 50370,
21+
"to": 50388
22+
}
23+
],
24+
"resourceExposurePolicy": {
25+
"allowDebugging": true,
26+
"allowDownloadingSource": false,
27+
"includeSourceInSymbolFile": false
28+
},
29+
"runtime": "12.0",
30+
"features": [
31+
"TranslationFile",
32+
"NoImplicitWith"
33+
]
34+
}

App 1/test2/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
test

App 2/app.json

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"id": "47272960-da80-4d02-88dc-ab72d6987964",
3+
"name": "App 2",
4+
"publisher": "BEYONDIT GmbH",
5+
"version": "2024.10.0.0",
6+
"brief": "App 2",
7+
"description": "App 2",
8+
"privacyStatement": "https://beyondit.gmbh/datenschutz",
9+
"EULA": "https://www.beyondit.gmbh/agb",
10+
"help": "http://docs.beyond365.de/",
11+
"contextSensitiveHelpUrl": "http://docs.beyond365.de/",
12+
"url": "https://beyondit.gmbh",
13+
"logo": "app.png",
14+
"dependencies": [],
15+
"screenshots": [],
16+
"platform": "22.0.0.0",
17+
"application": "22.0.0.0",
18+
"idRanges": [
19+
{
20+
"from": 50390,
21+
"to": 50499
22+
}
23+
],
24+
"resourceExposurePolicy": {
25+
"allowDebugging": true,
26+
"allowDownloadingSource": false,
27+
"includeSourceInSymbolFile": false
28+
},
29+
"runtime": "12.0",
30+
"features": [
31+
"TranslationFile",
32+
"NoImplicitWith"
33+
]
34+
}

App3/app.json

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"id": "beeafcb6-0dd4-4743-84d9-e191f2d0393a",
3+
"name": "App 3",
4+
"publisher": "BEYONDIT GmbH",
5+
"version": "2024.10.0.0",
6+
"brief": "App 3",
7+
"description": "App 3",
8+
"privacyStatement": "https://beyondit.gmbh/datenschutz",
9+
"EULA": "https://www.beyondit.gmbh/agb",
10+
"help": "http://docs.beyond365.de/",
11+
"contextSensitiveHelpUrl": "http://docs.beyond365.de/",
12+
"url": "https://beyondit.gmbh",
13+
"logo": "app.png",
14+
"dependencies": [],
15+
"screenshots": [],
16+
"platform": "22.0.0.0",
17+
"application": "22.0.0.0",
18+
"idRanges": [
19+
{
20+
"from": 50815,
21+
"to": 50830
22+
}
23+
],
24+
"resourceExposurePolicy": {
25+
"allowDebugging": true,
26+
"allowDownloadingSource": false,
27+
"includeSourceInSymbolFile": false
28+
},
29+
"runtime": "12.0",
30+
"features": [
31+
"TranslationFile",
32+
"NoImplicitWith"
33+
]
34+
}

App4/app.json

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"id": "325f9845-cf9a-4ee2-af9a-a2796efd5046",
3+
"name": "App 4",
4+
"publisher": "BEYONDIT GmbH",
5+
"version": "2024.10.0.0",
6+
"brief": "App 4",
7+
"description": "App 4",
8+
"privacyStatement": "https://beyondit.gmbh/datenschutz",
9+
"EULA": "https://www.beyondit.gmbh/agb",
10+
"help": "http://docs.beyond365.de/",
11+
"contextSensitiveHelpUrl": "http://docs.beyond365.de/",
12+
"url": "https://beyondit.gmbh",
13+
"logo": "app.png",
14+
"dependencies": [],
15+
"screenshots": [],
16+
"platform": "22.0.0.0",
17+
"application": "22.0.0.0",
18+
"idRanges": [
19+
{
20+
"from": 50115,
21+
"to": 50130
22+
}
23+
],
24+
"resourceExposurePolicy": {
25+
"allowDebugging": true,
26+
"allowDownloadingSource": false,
27+
"includeSourceInSymbolFile": false
28+
},
29+
"runtime": "12.0",
30+
"features": [
31+
"TranslationFile",
32+
"NoImplicitWith"
33+
]
34+
}

App5 - Copy/app.json

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"id": "8d8621d2-dd19-4071-82a7-936d97cbf41d",
3+
"name": "App 4",
4+
"publisher": "BEYONDIT GmbH",
5+
"version": "2024.10.0.0",
6+
"brief": "App 4",
7+
"description": "App 4",
8+
"privacyStatement": "https://beyondit.gmbh/datenschutz",
9+
"EULA": "https://www.beyondit.gmbh/agb",
10+
"help": "http://docs.beyond365.de/",
11+
"contextSensitiveHelpUrl": "http://docs.beyond365.de/",
12+
"url": "https://beyondit.gmbh",
13+
"logo": "app.png",
14+
"dependencies": [],
15+
"screenshots": [],
16+
"platform": "22.0.0.0",
17+
"application": "22.0.0.0",
18+
"idRanges": [
19+
{
20+
"from": 50115,
21+
"to": 50130
22+
}
23+
],
24+
"resourceExposurePolicy": {
25+
"allowDebugging": true,
26+
"allowDownloadingSource": false,
27+
"includeSourceInSymbolFile": false
28+
},
29+
"runtime": "12.0",
30+
"features": [
31+
"TranslationFile",
32+
"NoImplicitWith"
33+
]
34+
}

README.md

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
This is a readme of the repo
2+
3+
[comment]: <> (start_table)
4+
5+
| Repository | From | To |
6+
|------------------------------------|--------|--------|
7+
8+
[comment]: <> (end_table)
9+
10+
Some additional comments here

0 commit comments

Comments
 (0)