diff --git a/.github/workflows/update_json_date.yml b/.github/workflows/update_json_date.yml index 156c6621..410a6f62 100644 --- a/.github/workflows/update_json_date.yml +++ b/.github/workflows/update_json_date.yml @@ -40,8 +40,8 @@ jobs: - name: Get Open PRs run: | echo "Fetching open PRs..." - PRS=$(gh pr list --state open --json number,headRepositoryOwner,headRefName \ - --jq '[.[] | {number: .number, repo: .headRepositoryOwner.login, branch: .headRefName}]' || echo "") + PRS=$(gh pr list --state open --json number,headRepositoryOwner,headRepositoryUrl,headRefName \ + --jq '[.[] | {number: .number, repo: .headRepositoryUrl, branch: .headRefName}]' || echo "") if [[ -z "$PRS" || "$PRS" == "[]" ]]; then echo "No open PRs found." @@ -63,29 +63,24 @@ jobs: fi PR_NUMBER=$(echo "$PR_ENTRY" | jq -r '.number // empty') - PR_REPO=$(echo "$PR_ENTRY" | jq -r '.repo // empty') + PR_REPO_URL=$(echo "$PR_ENTRY" | jq -r '.repo // empty') PR_BRANCH=$(echo "$PR_ENTRY" | jq -r '.branch // empty') - if [[ -z "$PR_NUMBER" || -z "$PR_REPO" || -z "$PR_BRANCH" ]]; then + if [[ -z "$PR_NUMBER" || -z "$PR_REPO_URL" || -z "$PR_BRANCH" ]]; then echo "Skipping invalid PR entry: $PR_ENTRY" continue fi - echo "Processing PR #$PR_NUMBER from $PR_REPO:$PR_BRANCH" + echo "Processing PR #$PR_NUMBER from $PR_REPO_URL:$PR_BRANCH" - # Fork-Repo klonen (anstatt community-scripts) - REPO_URL="https://x-access-token:${{ env.GH_ACCESS_TOKEN }}@github.com/$PR_REPO/ProxmoxVE.git" - - # Sicherstellen, dass der Fork existiert - if ! git ls-remote --exit-code "$REPO_URL" &>/dev/null; then - echo "Repository $PR_REPO/ProxmoxVE does not exist or is private. Skipping..." - continue - fi + # Fork-Repo klonen + REPO_URL="${PR_REPO_URL/github.com/x-access-token:${{ env.GH_ACCESS_TOKEN }}@github.com}" + echo "Cloning $REPO_URL" git clone --depth=1 "$REPO_URL" cd ProxmoxVE || exit 1 - # Alle Branches abrufen & den richtigen Branch auschecken + # Sicherstellen, dass der Branch existiert git fetch origin "$PR_BRANCH" || { echo "Branch $PR_BRANCH does not exist in fork. Skipping..."; cd ..; rm -rf ProxmoxVE; continue; } git checkout "$PR_BRANCH"