Skip to content

Commit bad419d

Browse files
New release!
1 parent 900feb5 commit bad419d

File tree

8 files changed

+32
-90
lines changed

8 files changed

+32
-90
lines changed

.github/workflows/project@francescobianco@matrix-theme.yml renamed to .github/workflows/@francescobianco@matrix-theme.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Install Mush
1+
name: francescobianco/matrix-theme
22

33
on:
44
push:
@@ -9,7 +9,7 @@ env:
99
HACKATHON_PACKAGE_NAME: matrix-theme
1010

1111
jobs:
12-
install-mush:
12+
hackathon:
1313
runs-on: ubuntu-latest
1414
steps:
1515
- name: Install Mush

.github/workflows/template.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Install Mush
1+
name: template
22

33
on:
44
push:
@@ -9,7 +9,7 @@ env:
99
HACKATHON_PACKAGE_NAME: console
1010

1111
jobs:
12-
install-mush:
12+
hackathon:
1313
runs-on: ubuntu-latest
1414
steps:
1515
- name: Install Mush

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
# hackathon
1+
# hackathon
2+
3+
[![Install Mush](https://github.com/javanile/hackathon/actions/workflows/project@francescobianco@matrix-theme.yml/badge.svg)](https://github.com/javanile/hackathon/actions/workflows/project@francescobianco@matrix-theme.yml)

data/leaderboard.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[
2+
{"rank":1, "project":"francescobianco/matrix-theme", "stars":0},
3+
{}
4+
]

data/leaderboard.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0 francescobianco/matrix-theme

index.html

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -154,12 +154,8 @@ <h2>Hall of Fame 🏆</h2>
154154
// Simulated data fetch function
155155
function fetchData() {
156156
// Simulating an API call with setTimeout
157-
setTimeout(() => {
158-
const leaderboardData = [
159-
{ rank: 1, projectName: "Disco Data Dancer 💃", stars: 250, cicdStatus: true },
160-
{ rank: 2, projectName: "Chai Machine Learning 🍵", stars: 210, cicdStatus: true },
161-
{ rank: 3, projectName: "Bollywood Backend Beats 🎵", stars: 180, cicdStatus: false }
162-
];
157+
setTimeout(async () => {
158+
const leaderboardData = await fetch('./data/leaderboard.json').then(res => res.json());
163159

164160
const hallOfFameData = [
165161
{ month: "January", year: 2024, projectName: "Masala Code Machine 🌶️" },
@@ -169,12 +165,15 @@ <h2>Hall of Fame 🏆</h2>
169165
// Populate leaderboard
170166
const leaderboardBody = document.getElementById('leaderboardBody');
171167
leaderboardData.forEach(entry => {
168+
if (!entry.rank) return;
169+
const badge = "https://github.com/javanile/hackathon/actions/workflows/@francescobianco@matrix-theme.yml/badge.svg"
170+
const status = "https://github.com/javanile/hackathon/actions/workflows/@francescobianco@matrix-theme.yml"
172171
const row = `
173172
<tr>
174173
<td>${entry.rank}</td>
175-
<td>${entry.projectName}</td>
174+
<td><a href="https://github.com/${entry.project}" target="_blank">${entry.project}</td>
176175
<td>${entry.stars}</td>
177-
<td>${entry.cicdStatus ? '✅ Passed' : '❌ Not Passed'}</td>
176+
<td><a href="${status}" target="_blank"><img src="${badge}"></a></td>
178177
</tr>
179178
`;
180179
leaderboardBody.innerHTML += row;

packages/console/lib.sh

Lines changed: 0 additions & 71 deletions
This file was deleted.

scripts/generate-leaderboard.sh

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,22 @@ GITHUB_USER="javanile"
44
REPO_NAME="mush-get-started"
55
TOKEN="${GITHUB_TOKEN}"
66

7-
FORKS=$(curl -s -H "Authorization: token $TOKEN" "https://api.github.com/repos/$GITHUB_USER/$REPO_NAME/forks" | jq -r '.[].full_name')
7+
FORKS=$(curl -s -H "Authorization: token $TOKEN" "https://api.github.com/repos/$GITHUB_USER/$REPO_NAME/forks" | jq -r '.[] | {full_name, stargazers_count}')
88

9+
rm -f data/leaderboard.*
910
echo "Fork trovati per $GITHUB_USER/$REPO_NAME:"
10-
for FORK in $FORKS; do
11-
echo "Processing fork: $FORK"
12-
# Puoi eseguire operazioni su ogni fork, ad esempio clonarlo:
13-
# git clone "https://github.com/$FORK.git"
14-
WORKFLOW=".github/workflows/project@${FORK//\//@}.yml"
11+
for FORK in $(echo "$FORKS" | jq -r '.full_name'); do
12+
STARS=$(echo "$FORKS" | jq -r "select(.full_name == \"$FORK\") | .stargazers_count")
13+
echo "Processing fork: $FORK, Stars: $STARS"
14+
15+
WORKFLOW=".github/workflows/@${FORK//\//@}.yml"
1516
cp .github/workflows/template.yml "${WORKFLOW}"
17+
sed -i "s|name: template|name: ${FORK}|g" "${WORKFLOW}"
1618
sed -i "s|PACKAGE_NAME: console|PACKAGE_NAME: ${FORK#*/}|g" "${WORKFLOW}"
19+
echo "${STARS} ${FORK}" >> data/leaderboard.txt
1720
done
1821

22+
echo "[" > data/leaderboard.json
23+
sort -nr data/leaderboard.txt | awk '{print "{\"rank\":" NR ", \"project\":\"" $2 "\", \"stars\":" $1 "},"}' >> data/leaderboard.json
24+
echo "{}" >> data/leaderboard.json
25+
echo "]" >> data/leaderboard.json

0 commit comments

Comments
 (0)