ProxmoxVED/.github/workflows/get-versions-from-newreleases.yaml
2025-03-13 14:32:32 +01:00

47 lines
1.5 KiB
YAML

name: Crawl Versions from newreleases.io
on:
workflow_dispatch:
permissions:
contents: write
pull-requests: write
jobs:
move-to-main-repo:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
with:
repository: community-scripts/ProxmoxVED
ref: main
- name: Crawl from newreleases.io
env:
token: ${{ secrets.NEWRELEASES_TOKEN }}
run: |
ls -l
projects=$(curl -H "X-Key: $token" \
https://api.newreleases.io/v1/projects)
echo $projects > project_json
jq -r '.projects[] | "\(.id) \(.name)"' project_json | while read -r id name; do
version=$(curl -H "X-Key: $token" \
https://api.newreleases.io/v1/projects/$id/latest-release)
jq -n --arg name "$name" --arg version "$version" '{name: $name, version: $version}' > json/versions.json
done
- name: Commit JSON
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "GitHub Actions[bot]"
git checkout -b update_versions
git add json/versions.json
git commit -m "Update versions.json"
git push origin update_versions
gh pr create --title "[AUTOMATIC PR]Update versions.json" --body "Update versions.json, crawled from newreleases.io" --base main --head update_versions