mirror of
https://github.com/Azornes/Comfyui-LayerForge.git
synced 2026-03-21 20:52:12 -03:00
Update ComfyUIdownloads.yml
This commit is contained in:
68
.github/workflows/ComfyUIdownloads.yml
vendored
68
.github/workflows/ComfyUIdownloads.yml
vendored
@@ -2,7 +2,7 @@ name: LayerForge Top Downloads Badge
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
schedule:
|
schedule:
|
||||||
- cron: "0 * * * *" # co godzinę
|
- cron: "0 * * * *" # co godzinę
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
@@ -12,67 +12,47 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: gh login
|
- name: Pobierz dane z API LayerForge
|
||||||
run: echo "${{ secrets.SECRET_TOKEN }}" | gh auth login --with-token
|
|
||||||
|
|
||||||
- name: Query LayerForge API 10 times and find top download
|
|
||||||
run: |
|
run: |
|
||||||
echo "[]" > all_nodes.json
|
echo "[]" > all_nodes.json
|
||||||
for i in {1..10}; do
|
for i in {1..10}; do
|
||||||
curl -s https://api.comfy.org/nodes/layerforge >> tmp_$i.json
|
curl -s https://api.comfy.org/nodes/layerforge > tmp_$i.json
|
||||||
jq -s 'add' all_nodes.json tmp_$i.json > merged.json && mv merged.json all_nodes.json
|
jq -s 'add' all_nodes.json tmp_$i.json > merged.json && mv merged.json all_nodes.json
|
||||||
rm tmp_$i.json
|
rm tmp_$i.json
|
||||||
done
|
done
|
||||||
jq -s 'add | sort_by(.downloads) | reverse | .[0]' all_nodes.json > top_layerforge.json
|
jq -s 'add | sort_by(.downloads) | reverse | .[0]' all_nodes.json > top_layerforge.json
|
||||||
|
|
||||||
- name: create or update gist with top download
|
- name: Utwórz lub zaktualizuj Gist z danymi
|
||||||
id: set_id
|
id: set_id
|
||||||
run: |
|
run: |
|
||||||
if gh secret list | grep -q "LAYERFORGE_GIST_ID"
|
if gh secret list | grep -q "LAYERFORGE_GIST_ID"; then
|
||||||
then
|
echo "GIST_ID found"
|
||||||
echo "GIST_ID found"
|
echo "GIST=${{ secrets.LAYERFORGE_GIST_ID }}" >> $GITHUB_OUTPUT
|
||||||
echo "GIST=${{ secrets.LAYERFORGE_GIST_ID }}" >> $GITHUB_OUTPUT
|
curl https://gist.githubusercontent.com/${{ github.actor }}/${{ secrets.LAYERFORGE_GIST_ID }}/raw/top_layerforge.json > before.json
|
||||||
curl https://gist.githubusercontent.com/${{ github.actor }}/${{ secrets.LAYERFORGE_GIST_ID }}/raw/top_layerforge.json > before.json
|
if grep -q '404: Not Found' before.json; then
|
||||||
if grep -q '404: Not Found' before.json; then
|
|
||||||
gist_id=$(gh gist create top_layerforge.json | awk -F / '{print $NF}')
|
|
||||||
echo $gist_id | gh secret set LAYERFORGE_GIST_ID
|
|
||||||
echo "GIST=$gist_id" >> $GITHUB_OUTPUT
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
gist_id=$(gh gist create top_layerforge.json | awk -F / '{print $NF}')
|
gist_id=$(gh gist create top_layerforge.json | awk -F / '{print $NF}')
|
||||||
echo $gist_id | gh secret set LAYERFORGE_GIST_ID
|
echo $gist_id | gh secret set LAYERFORGE_GIST_ID
|
||||||
echo "GIST=$gist_id" >> $GITHUB_OUTPUT
|
echo "GIST=$gist_id" >> $GITHUB_OUTPUT
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
gist_id=$(gh gist create top_layerforge.json | awk -F / '{print $NF}')
|
||||||
|
echo $gist_id | gh secret set LAYERFORGE_GIST_ID
|
||||||
|
echo "GIST=$gist_id" >> $GITHUB_OUTPUT
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: create badge if needed
|
- name: Utwórz badge w formacie Markdown
|
||||||
run: |
|
run: |
|
||||||
COUNT=$(jq '.downloads' top_layerforge.json)
|
COUNT=$(jq '.downloads' top_layerforge.json)
|
||||||
NAME=$(jq -r '.name' top_layerforge.json)
|
NAME=$(jq -r '.name' top_layerforge.json)
|
||||||
if [ ! -f LAYERFORGE.md ]; then
|
shields="https://img.shields.io/badge/dynamic/json?color=informational&label=TopLayerForge&query=downloads&url="
|
||||||
shields="https://img.shields.io/badge/dynamic/json?color=informational&label=TopLayerForge&query=downloads&url="
|
url="https://gist.githubusercontent.com/${{ github.actor }}/${{ steps.set_id.outputs.GIST }}/raw/top_layerforge.json"
|
||||||
url="https://gist.githubusercontent.com/${{ github.actor }}/${{ steps.set_id.outputs.GIST }}/raw/top_layerforge.json"
|
echo "[](https://comfy.org)" > LAYERFORGE.md
|
||||||
repo="https://comfy.org"
|
git add LAYERFORGE.md
|
||||||
echo ''> LAYERFORGE.md
|
git config --global user.name "GitHub Action"
|
||||||
echo '
|
git config --global user.email "action@github.com"
|
||||||
**Markdown**
|
git commit -m "Create LayerForge badge"
|
||||||
|
|
||||||
```markdown' >> LAYERFORGE.md
|
- name: Zaktualizuj Gist
|
||||||
echo "[]($repo)" >> LAYERFORGE.md
|
|
||||||
echo '
|
|
||||||
```
|
|
||||||
|
|
||||||
**HTML**
|
|
||||||
```html' >> LAYERFORGE.md
|
|
||||||
echo "<a href='$repo'><img alt='Top LayerForge Node' src='$shields$url'></a>" >> LAYERFORGE.md
|
|
||||||
echo '```' >> LAYERFORGE.md
|
|
||||||
|
|
||||||
git add LAYERFORGE.md
|
|
||||||
git config --global user.name "GitHub Action"
|
|
||||||
git config --global user.email "action@github.com"
|
|
||||||
git commit -m "Create LayerForge badge"
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Update Gist
|
|
||||||
run: |
|
run: |
|
||||||
content=$(cat top_layerforge.json | jq -c .)
|
content=$(cat top_layerforge.json | jq -c .)
|
||||||
echo '{"description": "Top LayerForge Node", "files": {"top_layerforge.json": {"content": '"$content"'}}}' > patch.json
|
echo '{"description": "Top LayerForge Node", "files": {"top_layerforge.json": {"content": '"$content"'}}}' > patch.json
|
||||||
@@ -81,7 +61,7 @@ jobs:
|
|||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-d @patch.json https://api.github.com/gists/${{ steps.set_id.outputs.GIST }}
|
-d @patch.json https://api.github.com/gists/${{ steps.set_id.outputs.GIST }}
|
||||||
|
|
||||||
- name: Push
|
- name: Wypchnij zmiany do repozytorium
|
||||||
uses: ad-m/github-push-action@master
|
uses: ad-m/github-push-action@master
|
||||||
with:
|
with:
|
||||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|||||||
Reference in New Issue
Block a user