Skip to content

Commit d46cc83

Browse files
committed
prefetch data
1 parent 6def26b commit d46cc83

File tree

1 file changed

+68
-5
lines changed

1 file changed

+68
-5
lines changed

.github/workflows/check-package-versions.yml

Lines changed: 68 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,70 @@ jobs:
338338
author: "Claude <claude@anthropic.com>"
339339
committer: "Claude <claude@anthropic.com>"
340340

341+
- name: Fetch upstream build files
342+
if: steps.existing-pr.outputs.exists != 'true' && steps.create-pr.outputs.pull-request-number
343+
id: upstream
344+
run: |
345+
PACKAGES='${{ toJson(matrix.group.packages) }}'
346+
mkdir -p .upstream-build-files
347+
348+
# Define build file patterns for different project types
349+
declare -A BUILD_FILES=(
350+
# Rust projects
351+
[eza]="Cargo.toml"
352+
[starship]="Cargo.toml"
353+
[wifitui]="Cargo.toml"
354+
# Go projects
355+
[lazygit]="go.mod"
356+
# Python projects
357+
[uwsm]="pyproject.toml"
358+
# Default for Hyprland ecosystem is CMakeLists.txt
359+
)
360+
361+
UPSTREAM_CONTENT=""
362+
363+
while read -r pkg_data; do
364+
PKG=$(echo "$pkg_data" | jq -r '.package')
365+
REPO=$(echo "$pkg_data" | jq -r '.repo')
366+
VERSION=$(echo "$pkg_data" | jq -r '.new_version')
367+
368+
# Determine which build file to fetch
369+
BUILD_FILE="${BUILD_FILES[$PKG]:-CMakeLists.txt}"
370+
371+
echo "Fetching $BUILD_FILE for $PKG v$VERSION from $REPO..."
372+
373+
# Try to fetch the build file
374+
URL="https://raw.githubusercontent.com/${REPO}/v${VERSION}/${BUILD_FILE}"
375+
CONTENT=$(curl -sL "$URL" 2>/dev/null)
376+
377+
if [[ -z "$CONTENT" || "$CONTENT" == "404"* ]]; then
378+
# Try without 'v' prefix
379+
URL="https://raw.githubusercontent.com/${REPO}/${VERSION}/${BUILD_FILE}"
380+
CONTENT=$(curl -sL "$URL" 2>/dev/null)
381+
fi
382+
383+
if [[ -n "$CONTENT" && "$CONTENT" != "404"* ]]; then
384+
# Save to file for Claude to read
385+
echo "$CONTENT" > ".upstream-build-files/${PKG}-${BUILD_FILE//\//-}"
386+
UPSTREAM_CONTENT="${UPSTREAM_CONTENT}
387+
388+
=== ${PKG} (${BUILD_FILE}) ===
389+
${CONTENT}
390+
"
391+
echo " ✓ Fetched successfully"
392+
else
393+
echo " ✗ Could not fetch $BUILD_FILE"
394+
UPSTREAM_CONTENT="${UPSTREAM_CONTENT}
395+
396+
=== ${PKG} (${BUILD_FILE}) ===
397+
[Could not fetch - manual verification required]
398+
"
399+
fi
400+
done < <(echo "$PACKAGES" | jq -c '.[]')
401+
402+
# Save all content to a file for the prompt
403+
echo "$UPSTREAM_CONTENT" > .upstream-build-files/all-content.txt
404+
341405
- name: Analyze and update specs with Claude
342406
if: steps.existing-pr.outputs.exists != 'true' && steps.create-pr.outputs.pull-request-number
343407
uses: anthropics/claude-code-action@v1
@@ -349,13 +413,12 @@ jobs:
349413
The following packages were updated (version bumps already applied to spec files):
350414
${{ toJson(matrix.group.packages) }}
351415
416+
The upstream build configuration files have been pre-fetched and saved to `.upstream-build-files/`.
417+
Read the file `.upstream-build-files/all-content.txt` to see all the upstream build files.
418+
352419
For each package, please:
353420
354-
1. Fetch the upstream build configuration files to check for dependency changes:
355-
- CMakeLists.txt or meson.build for C/C++ projects (Hyprland ecosystem)
356-
- Cargo.toml for Rust projects (eza, starship, wifitui)
357-
- go.mod for Go projects (lazygit)
358-
- setup.py or pyproject.toml for Python projects (uwsm)
421+
1. Read the upstream build configuration from `.upstream-build-files/all-content.txt`
359422
360423
2. Compare the dependencies in the upstream build files against the current spec file's BuildRequires and Requires sections.
361424

0 commit comments

Comments
 (0)