From 2ab5548fa8db1337e3203afdd47736be751cc433 Mon Sep 17 00:00:00 2001 From: niklascfw Date: Thu, 5 Mar 2026 19:25:06 +0100 Subject: [PATCH] Initial Commit --- .github/workflows/sync-release.yml | 78 ++++++++++++++++++++++++++++++ README.md | 7 +++ 2 files changed, 85 insertions(+) create mode 100644 .github/workflows/sync-release.yml create mode 100644 README.md diff --git a/.github/workflows/sync-release.yml b/.github/workflows/sync-release.yml new file mode 100644 index 0000000..cbf6529 --- /dev/null +++ b/.github/workflows/sync-release.yml @@ -0,0 +1,78 @@ +name: Sync Upstream Release + +on: + schedule: + - cron: "0 */6 * * *" + workflow_dispatch: + +permissions: + contents: write + +jobs: + sync: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Fetch upstream release metadata + id: upstream + run: | + RELEASE=$(curl -sf https://api.github.com/repos/muxi1/switch-cheats-db/releases/latest) + + TAG=$(echo "$RELEASE" | jq -r '.tag_name') + NAME=$(echo "$RELEASE" | jq -r '.name // empty') + BODY=$(echo "$RELEASE" | jq -r '.body // empty') + + echo "tag=$TAG" >> "$GITHUB_OUTPUT" + + # name defaults to tag when upstream leaves it empty + if [ -z "$NAME" ]; then + echo "name=$TAG" >> "$GITHUB_OUTPUT" + else + echo "name=$NAME" >> "$GITHUB_OUTPUT" + fi + + # body via file to preserve newlines + echo "$BODY" > /tmp/release_body.md + + # collect asset download URLs + echo "$RELEASE" | jq -r '.assets[].browser_download_url' > /tmp/asset_urls.txt + + - name: Check if release already exists + id: check + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + TAG="${{ steps.upstream.outputs.tag }}" + if gh release view "$TAG" >/dev/null 2>&1; then + echo "exists=true" >> "$GITHUB_OUTPUT" + else + echo "exists=false" >> "$GITHUB_OUTPUT" + fi + + - name: Download assets + if: steps.check.outputs.exists == 'false' + run: | + mkdir -p /tmp/assets + while IFS= read -r url; do + echo "Downloading $url" + curl -fL -o "/tmp/assets/$(basename "$url")" "$url" + done < /tmp/asset_urls.txt + + - name: Create release with assets + if: steps.check.outputs.exists == 'false' + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + TAG="${{ steps.upstream.outputs.tag }}" + NAME="${{ steps.upstream.outputs.name }}" + + ASSET_ARGS="" + for f in /tmp/assets/*; do + ASSET_ARGS="$ASSET_ARGS $f" + done + + gh release create "$TAG" \ + --title "$NAME" \ + --notes-file /tmp/release_body.md \ + $ASSET_ARGS diff --git a/README.md b/README.md new file mode 100644 index 0000000..38e26f6 --- /dev/null +++ b/README.md @@ -0,0 +1,7 @@ +**Cheats für OmniNX** + +Diese Datenbank wird vom "Cheats-Updater" aus dem OmniNX Pack automatisch heruntergeladen und verarbeitet. + +--- + +> **Hinweis:** Dieses Repository ist ein automatisch aktualisierter Mirror von [muxi1/switch-cheats-db](https://github.com/muxi1/switch-cheats-db).