Check for new repositories and update ranks
All checks were successful
Update Community Skins README / Full CI/CD Pipeline (push) Successful in 4s
All checks were successful
Update Community Skins README / Full CI/CD Pipeline (push) Successful in 4s
This commit is contained in:
157
.gitea/workflows/ci.yml
Normal file
157
.gitea/workflows/ci.yml
Normal file
@@ -0,0 +1,157 @@
|
|||||||
|
name: Update Community Skins README
|
||||||
|
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
- cron: '*/5 * * * *'
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
env:
|
||||||
|
README_PATH: "${{ github.workspace }}/README.md"
|
||||||
|
IMAGE_NAME: arlind/skins
|
||||||
|
GITEA_API: https://${{ vars.CONTAINER_REGISTRY }}/api/v1
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
generate_everything:
|
||||||
|
name: Full CI/CD Pipeline
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
image: ${{ vars.CONTAINER_REGISTRY }}/${{ env.IMAGE_NAME }}:latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout Repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.TOKEN }}
|
||||||
|
|
||||||
|
- name: Find matching skin entries
|
||||||
|
id: find_skins
|
||||||
|
shell: sh
|
||||||
|
run: |
|
||||||
|
total_valid_entries=0
|
||||||
|
user_rows_file=$(mktemp)
|
||||||
|
avatar_rows_file=$(mktemp)
|
||||||
|
|
||||||
|
echo "Fetching users page 1..." >&2
|
||||||
|
users_json=$(curl -sSL -H "Authorization: token ${{ secrets.TOKEN }}" "$GITEA_API/admin/users?limit=50&page=1")
|
||||||
|
|
||||||
|
jq_type=$(echo "$users_json" | jq -r 'type' 2>/dev/null || echo "jq_error_type")
|
||||||
|
jq_length=$(echo "$users_json" | jq 'length' 2>/dev/null || echo "jq_error_length")
|
||||||
|
if [ "$jq_type" != "array" ] || [ "$jq_length" -eq 0 ]; then
|
||||||
|
echo "No users found or invalid JSON received on page 1. (Type: $jq_type, Length: $jq_length)." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
i=0
|
||||||
|
while [ "$i" -lt "$jq_length" ]; do
|
||||||
|
user_login=$(echo "$users_json" | jq -r ".[$i].login")
|
||||||
|
echo "Processing user: $user_login" >&2
|
||||||
|
|
||||||
|
repos_json=$(curl -sSL -H "Authorization: token ${{ secrets.TOKEN }}" "$GITEA_API/users/$user_login/repos")
|
||||||
|
repos_type=$(echo "$repos_json" | jq -r 'type' 2>/dev/null || echo "not_array")
|
||||||
|
repos_count=$(echo "$repos_json" | jq 'length' 2>/dev/null || echo "0")
|
||||||
|
if [ "$repos_type" != "array" ] || [ "$repos_count" -eq 0 ]; then
|
||||||
|
echo " No repos or invalid JSON for $user_login" >&2
|
||||||
|
i=$((i + 1))
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
j=0
|
||||||
|
while [ "$j" -lt "$repos_count" ]; do
|
||||||
|
owner=$(echo "$repos_json" | jq -r ".[$j].owner.login")
|
||||||
|
repo=$(echo "$repos_json" | jq -r ".[$j].name")
|
||||||
|
html_url=$(echo "$repos_json" | jq -r ".[$j].html_url")
|
||||||
|
|
||||||
|
echo " Checking repo: $repo" >&2
|
||||||
|
readme_json=$(curl -sSL -H "Authorization: token ${{ secrets.TOKEN }}" "$GITEA_API/repos/$owner/$repo/contents/README.md" || echo "{}")
|
||||||
|
|
||||||
|
if echo "$readme_json" | jq -e '.content' >/dev/null 2>&1; then
|
||||||
|
content=$(echo "$readme_json" | jq -r .content | base64 -d || echo "")
|
||||||
|
|
||||||
|
echo "$content" | grep -q "^---$" && \
|
||||||
|
echo "$content" | grep -q "^gitea: none" && \
|
||||||
|
echo "$content" | grep -q "^include_toc: true" && \
|
||||||
|
echo "$content" | grep -q "^# Skins"
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
osu_id=$(echo "$content" | awk '/osuid:[ ]*[0-9]+/ { match($0, /[0-9]+/); print substr($0, RSTART, RLENGTH); exit }')
|
||||||
|
if [ -n "$osu_id" ]; then
|
||||||
|
user_data=$(curl -s "https://osu.ppy.sh/api/get_user?k=${{ secrets.OSUAPIV1 }}&u=$osu_id&type=id")
|
||||||
|
pp_rank=$(echo "$user_data" | jq -r '.[0].pp_rank // "9999999"')
|
||||||
|
pp_country_rank=$(echo "$user_data" | jq -r '.[0].pp_country_rank // "-"')
|
||||||
|
username=$(echo "$user_data" | jq -r '.[0].username // "'$owner'"')
|
||||||
|
padded_rank=$(printf "%07d" "$pp_rank")
|
||||||
|
|
||||||
|
printf "%s| <tr><td>%s</td><td>%s</td><td>%s</td><td><a href=\"https://osu.ppy.sh/users/%s\">Profile</a></td><td><a href=\"%s\">Skins</a></td></tr>\n" \
|
||||||
|
"$padded_rank" "$username" "$pp_rank" "$pp_country_rank" "$osu_id" "$html_url" >> "$user_rows_file"
|
||||||
|
printf "%s| <a href=\"%s\"><img src=\"https://a.ppy.sh/%s\" width=175 height=175></a>\n" \
|
||||||
|
"$padded_rank" "$html_url" "$osu_id" >> "$avatar_rows_file"
|
||||||
|
total_valid_entries=$((total_valid_entries + 1))
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
j=$((j + 1))
|
||||||
|
done
|
||||||
|
i=$((i + 1))
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "user_rows_file=$user_rows_file" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "avatar_rows_file=$avatar_rows_file" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "total_valid_entries=$total_valid_entries" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
|
- name: Update README with user skins
|
||||||
|
run: |
|
||||||
|
echo "# osu! Swiss Community Skin collection" > "$README_PATH"
|
||||||
|
echo "" >> "$README_PATH"
|
||||||
|
echo "Welcome to the osu! Swiss Community Skin collection, this repository archives and showcases Skins osc members use." >> "$README_PATH"
|
||||||
|
echo "" >> "$README_PATH"
|
||||||
|
echo "Enjoy looking around, click file names to download the skins." >> "$README_PATH"
|
||||||
|
echo "" >> "$README_PATH"
|
||||||
|
echo "## How do I add my skins here?" >> "$README_PATH"
|
||||||
|
echo "" >> "$README_PATH"
|
||||||
|
echo "If you're interested in adding your skins here please follow this tutorial [how-to-use](/how-to-use.md)" >> "$README_PATH"
|
||||||
|
echo "" >> "$README_PATH"
|
||||||
|
echo "## Skins" >> "$README_PATH"
|
||||||
|
echo "" >> "$README_PATH"
|
||||||
|
echo "<details>" >> "$README_PATH"
|
||||||
|
echo " <summary>list instead of icons</summary>" >> "$README_PATH"
|
||||||
|
echo " <br>" >> "$README_PATH"
|
||||||
|
echo " <table border=\"1\" cellpadding=\"5\" cellspacing=\"0\">" >> "$README_PATH"
|
||||||
|
echo " <thead>" >> "$README_PATH"
|
||||||
|
echo " <tr>" >> "$README_PATH"
|
||||||
|
echo " <th>Name</th>" >> "$README_PATH"
|
||||||
|
echo " <th>Global Rank</th>" >> "$README_PATH"
|
||||||
|
echo " <th>Country Rank</th>" >> "$README_PATH"
|
||||||
|
echo " <th>Profile</th>" >> "$README_PATH"
|
||||||
|
echo " <th>Skins</th>" >> "$README_PATH"
|
||||||
|
echo " </tr>" >> "$README_PATH"
|
||||||
|
echo " </thead>" >> "$README_PATH"
|
||||||
|
echo " <tbody>" >> "$README_PATH"
|
||||||
|
sort -t '|' -k1,1n "${{ steps.find_skins.outputs.user_rows_file }}" | cut -d'|' -f2- >> "$README_PATH"
|
||||||
|
echo " </tbody>" >> "$README_PATH"
|
||||||
|
echo " </table>" >> "$README_PATH"
|
||||||
|
echo "</details>" >> "$README_PATH"
|
||||||
|
echo "" >> "$README_PATH"
|
||||||
|
echo "<p align=\"center\">" >> "$README_PATH"
|
||||||
|
sort -t '|' -k1,1n "${{ steps.find_skins.outputs.avatar_rows_file }}" | cut -d'|' -f2- >> "$README_PATH"
|
||||||
|
echo "</p>" >> "$README_PATH"
|
||||||
|
rm -f "${{ steps.find_skins.outputs.user_rows_file }}" "${{ steps.find_skins.outputs.avatar_rows_file }}"
|
||||||
|
echo "Generated skins section and updated '$README_PATH' successfully." >&2
|
||||||
|
|
||||||
|
- name: Configure Git
|
||||||
|
run: |
|
||||||
|
git config user.email "arlind@sulej.ch"
|
||||||
|
git config user.name "ci-bot"
|
||||||
|
git config lfs.https://${{ vars.CONTAINER_REGISTRY }}/arlind/skins.git/info/lfs.locksverify true
|
||||||
|
|
||||||
|
- name: Add and Commit changes
|
||||||
|
run: |
|
||||||
|
git config advice.addIgnoredFile false
|
||||||
|
git add README.md
|
||||||
|
git commit -m "[ci skip] push back from pipeline" -q || echo "No changes to commit"
|
||||||
|
|
||||||
|
- name: Push changes and create tag
|
||||||
|
run: |
|
||||||
|
if [ "${GITHUB_REF}" = "refs/heads/main" ]; then
|
||||||
|
git push origin HEAD:main || echo "No changes to push"
|
||||||
|
else
|
||||||
|
git push origin HEAD:"${GITHUB_REF_NAME}" || echo "No changes to push"
|
||||||
|
fi
|
||||||
121
.gitea/workflows/deploy-ci.yaml
Normal file
121
.gitea/workflows/deploy-ci.yaml
Normal file
@@ -0,0 +1,121 @@
|
|||||||
|
name: Sync CI from skins-template to Every User Repository
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
env:
|
||||||
|
TEMPLATE_REPO_URL: https://${{ secrets.TOKEN }}@${{ vars.CONTAINER_REGISTRY }}/osc/skins-template.git
|
||||||
|
TEMPLATE_REL_PATH: .gitea/workflows/ci.yml
|
||||||
|
GITEA_API: https://${{ vars.CONTAINER_REGISTRY }}/api/v1
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
sync-all:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
image: ${{ vars.CONTAINER_REGISTRY }}/arlind/skins:latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Clone skins-template
|
||||||
|
run: |
|
||||||
|
echo "[Sync CI Started]"
|
||||||
|
git clone --quiet "${{ env.TEMPLATE_REPO_URL }}" --depth 1 template-repo
|
||||||
|
cd template-repo
|
||||||
|
git checkout --quiet HEAD -- "${{ env.TEMPLATE_REL_PATH }}"
|
||||||
|
|
||||||
|
- name: Fetch and update every user repository
|
||||||
|
run: |
|
||||||
|
page=1
|
||||||
|
per_page=50
|
||||||
|
|
||||||
|
while :; do
|
||||||
|
users_json=$(
|
||||||
|
curl -sSL -H "Authorization: token ${{ secrets.TOKEN }}" \
|
||||||
|
"${{ env.GITEA_API }}/admin/users?limit=$per_page&page=$page"
|
||||||
|
)
|
||||||
|
users_count=$(echo "$users_json" | jq 'length')
|
||||||
|
if [ "$users_count" -eq 0 ]; then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
|
||||||
|
for i in $(seq 0 $((users_count - 1))); do
|
||||||
|
user_login=$(echo "$users_json" | jq -r ".[$i].login")
|
||||||
|
repos_json=$(
|
||||||
|
curl -sSL -H "Authorization: token ${{ secrets.TOKEN }}" \
|
||||||
|
"${{ env.GITEA_API }}/users/${user_login}/repos"
|
||||||
|
)
|
||||||
|
repo_count=$(echo "$repos_json" | jq 'length')
|
||||||
|
|
||||||
|
for j in $(seq 0 $((repo_count - 1))); do
|
||||||
|
owner=$(echo "$repos_json" | jq -r ".[$j].owner.login")
|
||||||
|
repo=$(echo "$repos_json" | jq -r ".[$j].name")
|
||||||
|
|
||||||
|
(
|
||||||
|
set -e
|
||||||
|
echo ""
|
||||||
|
echo "[Processing repository: ${owner}/${repo}]"
|
||||||
|
|
||||||
|
echo " Checking README.md content"
|
||||||
|
readme_json=$(curl -sSL -H "Authorization: token ${{ secrets.TOKEN }}" \
|
||||||
|
"${{ env.GITEA_API }}/repos/${owner}/${repo}/contents/README.md" || echo "{}")
|
||||||
|
|
||||||
|
if ! echo "$readme_json" | jq -e '.content' >/dev/null 2>&1; then
|
||||||
|
echo " → No README.md found or inaccessible, skipping ${owner}/${repo}"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
content=$(echo "$readme_json" | jq -r .content | base64 -d 2>/dev/null || echo "")
|
||||||
|
if ! echo "$content" | head -n 20 | grep -q "^---$"; then
|
||||||
|
echo " → Missing YAML front matter (---), skipping ${owner}/${repo}"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
if ! ( echo "$content" | grep -q "^gitea: none" \
|
||||||
|
&& echo "$content" | grep -q "^include_toc: true" \
|
||||||
|
&& echo "$content" | grep -q "^# Skins" ); then
|
||||||
|
echo " → README.md does not match required headers, skipping ${owner}/${repo}"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo " ✓ README.md matches expected format; proceeding"
|
||||||
|
|
||||||
|
echo " Cloning ${owner}/${repo}..."
|
||||||
|
tmpdir=$(mktemp -d)
|
||||||
|
git clone --quiet "https://${{ secrets.TOKEN }}@${{ vars.CONTAINER_REGISTRY }}/${owner}/${repo}.git" \
|
||||||
|
--depth 1 "$tmpdir"
|
||||||
|
|
||||||
|
cd "$tmpdir"
|
||||||
|
echo " Configuring commit identity"
|
||||||
|
git config user.email "arlind@sulej.ch"
|
||||||
|
git config user.name "ci-bot"
|
||||||
|
|
||||||
|
echo " Copying CI file into .gitea/workflows/ci.yml"
|
||||||
|
mkdir -p .gitea/workflows
|
||||||
|
cp "/workspace/osc/skins/template-repo/${{ env.TEMPLATE_REL_PATH }}" \
|
||||||
|
".gitea/workflows/ci.yml"
|
||||||
|
git add ".gitea/workflows/ci.yml"
|
||||||
|
|
||||||
|
echo " Checking for staged changes"
|
||||||
|
if git diff --cached --quiet; then
|
||||||
|
echo " → No changes detected, skipping update for ${owner}/${repo}"
|
||||||
|
else
|
||||||
|
echo " ✓ Changes detected"
|
||||||
|
echo " Committing update"
|
||||||
|
git commit -m "Update CI"
|
||||||
|
echo " Pushing to main branch"
|
||||||
|
git push origin HEAD:main
|
||||||
|
echo " ✓ Update pushed"
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd - >/dev/null
|
||||||
|
rm -rf "$tmpdir"
|
||||||
|
echo "[Completed ${owner}/${repo}]"
|
||||||
|
) || {
|
||||||
|
echo "⚠ Skipping ${owner}/${repo} due to an error."
|
||||||
|
}
|
||||||
|
done
|
||||||
|
done
|
||||||
|
|
||||||
|
page=$((page + 1))
|
||||||
|
done
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "[Sync CI Complete]"
|
||||||
30
README.md
30
README.md
@@ -1,30 +0,0 @@
|
|||||||
# osu! Swiss Community
|
|
||||||
|
|
||||||
Welcome to the osu! Swiss Community skinhub, this repository archives and showcases lots of player-made skins.
|
|
||||||
|
|
||||||
Enjoy looking around, click file names to download the skins.
|
|
||||||
|
|
||||||
## How do I add my skins here?
|
|
||||||
|
|
||||||
If you're interested in adding your skins here please follow this tutorial [how-to-use](/how-to-use.md)
|
|
||||||
|
|
||||||
## Skins
|
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary>list instead of icons</summary><br>
|
|
||||||
<a href="https://git.sulejmani.xyz/arlind/skins">Arlind</a><br>
|
|
||||||
<a href="https://git.sulejmani.xyz/Skellers/ooga_booga">Skellers</a><br>
|
|
||||||
<a href="https://git.sulejmani.xyz/marcel7/krasseskins">marcel7</a><br>
|
|
||||||
</details>
|
|
||||||
|
|
||||||
<p align="center">
|
|
||||||
<a href="https://osu.ppy.sh/users/13792719">
|
|
||||||
<img src="https://a.ppy.sh/13792719" width="175" height="175">
|
|
||||||
</a>
|
|
||||||
<a href="https://osu.ppy.sh/users/8040245">
|
|
||||||
<img src="https://a.ppy.sh/8040245" width="175" height="175">
|
|
||||||
</a>
|
|
||||||
<a href="https://osu.ppy.sh/users/13062430">
|
|
||||||
<img src="https://a.ppy.sh/13062430" width="175" height="175">
|
|
||||||
</a>
|
|
||||||
</p>
|
|
||||||
|
|||||||
BIN
docs/example_variables.png
Normal file
BIN
docs/example_variables.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
BIN
docs/secret2.png
BIN
docs/secret2.png
Binary file not shown.
|
Before Width: | Height: | Size: 11 KiB |
@@ -70,15 +70,24 @@ Go to your repository's **Settings**.
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
Then under **Actions** open the **Secrets** tab and add these two:
|
Then under **Actions** open the **Secrets** tab and add this:
|
||||||
|
|
||||||
| Secret Name | Secret Value |
|
| Secret Name | Secret Value |
|
||||||
| -------------------- | -------------------------- |
|
| ----------- | -------------------------- |
|
||||||
| `TOKEN` | The token you just created |
|
| `TOKEN` | The token you just created |
|
||||||
| `CONTAINER_REGISTRY` | `git.sulejmani.xyz` |
|
|
||||||
|
|
||||||

|

|
||||||

|
|
||||||
|
Then under **Actions** open the **Variables** tab and add these two:
|
||||||
|
|
||||||
|
| Variable Name | Variable Value |
|
||||||
|
| -------------------- | ------------------- |
|
||||||
|
| `CONTAINER_REGISTRY` | `git.sulejmani.xyz` |
|
||||||
|
| `OSUID` | Your osu player id |
|
||||||
|
|
||||||
|
So in my case my osu profile is https://osu.ppy.sh/users/13792719 and I use 13792719
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -213,7 +222,7 @@ git push
|
|||||||
|
|
||||||
### 11. Adding your skin to https://git.sulejmani.xyz/osc/skins
|
### 11. Adding your skin to https://git.sulejmani.xyz/osc/skins
|
||||||
|
|
||||||
After you did every step please DM @arlind on discord
|
After you did every step it should be in https://git.sulejmani.xyz/osc/skins after a couple minutes, if it doesn't show up please message me on Discord.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user