@@ -21,60 +21,85 @@ jobs:
2121 fail-fast : false
2222 matrix :
2323 include :
24- # Hyprland ecosystem
24+ # Hyprland ecosystem (all use GitHub releases)
2525 - package : hyprutils
2626 repo : hyprwm/hyprutils
27+ version_source : release
2728 - package : hyprlang
2829 repo : hyprwm/hyprlang
30+ version_source : release
2931 - package : hyprwayland-scanner
3032 repo : hyprwm/hyprwayland-scanner
33+ version_source : release
3134 - package : hyprgraphics
3235 repo : hyprwm/hyprgraphics
36+ version_source : release
3337 - package : hyprcursor
3438 repo : hyprwm/hyprcursor
39+ version_source : release
3540 - package : hyprland-protocols
3641 repo : hyprwm/hyprland-protocols
42+ version_source : release
3743 - package : aquamarine
3844 repo : hyprwm/aquamarine
45+ version_source : release
3946 - package : hyprland-qt-support
4047 repo : hyprwm/hyprland-qt-support
48+ version_source : release
4149 - package : hyprland
4250 repo : hyprwm/Hyprland
51+ version_source : release
4352 - package : hyprlock
4453 repo : hyprwm/hyprlock
54+ version_source : release
4555 - package : hypridle
4656 repo : hyprwm/hypridle
57+ version_source : release
4758 - package : hyprpaper
4859 repo : hyprwm/hyprpaper
60+ version_source : release
4961 - package : xdg-desktop-portal-hyprland
5062 repo : hyprwm/xdg-desktop-portal-hyprland
63+ version_source : release
5164 - package : hyprpolkitagent
5265 repo : hyprwm/hyprpolkitagent
66+ version_source : release
5367 - package : hyprtoolkit
5468 repo : hyprwm/hyprtoolkit
69+ version_source : release
5570 - package : hyprland-guiutils
5671 repo : hyprwm/hyprland-guiutils
72+ version_source : release
5773 # CLI tools
5874 - package : eza
5975 repo : eza-community/eza
76+ version_source : release
6077 - package : starship
6178 repo : starship/starship
79+ version_source : release
6280 - package : lazygit
6381 repo : jesseduffield/lazygit
82+ version_source : release
6483 - package : wifitui
6584 repo : shazow/wifitui
85+ version_source : release
6686 # Other
6787 - package : glaze
6888 repo : stephenberry/glaze
89+ version_source : release
6990 - package : uwsm
7091 repo : Vladimir-csp/uwsm
92+ version_source : tag
7193 - package : quickshell
7294 repo : quickshell-mirror/quickshell
95+ version_source : tag
7396 - package : regreet
7497 repo : rharish101/ReGreet
98+ version_source : release
7599 # livesys-scripts uses our fork, skip auto-update
76100 # - package: livesys-scripts
77101 # repo: binarypie-dev/livesys-scripts
102+ # version_source: tag
78103
79104 steps :
80105 - name : Check if should run
@@ -96,16 +121,28 @@ jobs:
96121 env :
97122 GH_TOKEN : ${{ github.token }}
98123 run : |
99- # Get latest release from GitHub
100- RELEASE=$(gh api repos/${{ matrix.repo }}/releases/latest --jq '.tag_name' 2>/dev/null || echo "")
124+ VERSION_SOURCE="${{ matrix.version_source }}"
125+ RESULT=""
101126
102- # If no releases, try tags
103- if [ -z "$RELEASE" ]; then
104- RELEASE=$(gh api repos/${{ matrix.repo }}/tags --jq '.[0].name' 2>/dev/null || echo "")
127+ if [ "$VERSION_SOURCE" = "tag" ]; then
128+ # Use tags API directly
129+ echo "Checking tags for ${{ matrix.repo }}..."
130+ RESULT=$(gh api repos/${{ matrix.repo }}/tags --jq '.[0].name' 2>/dev/null) || RESULT=""
131+ else
132+ # Use releases API (default)
133+ echo "Checking releases for ${{ matrix.repo }}..."
134+ RESULT=$(gh api repos/${{ matrix.repo }}/releases/latest --jq '.tag_name' 2>/dev/null) || RESULT=""
135+ fi
136+
137+ # Check if we got a valid response (not empty and not an error message)
138+ if [ -z "$RESULT" ] || echo "$RESULT" | grep -q "Not Found\|message"; then
139+ echo "Could not determine upstream version for ${{ matrix.package }}"
140+ echo "version=" >> $GITHUB_OUTPUT
141+ exit 0
105142 fi
106143
107144 # Strip 'v' prefix if present
108- VERSION="${RELEASE #v}"
145+ VERSION="${RESULT #v}"
109146
110147 echo "version=$VERSION" >> $GITHUB_OUTPUT
111148 echo "Upstream version: $VERSION"
@@ -155,8 +192,26 @@ jobs:
155192 echo "needs_update=false" >> $GITHUB_OUTPUT
156193 fi
157194
158- - name : Update spec file
195+ - name : Check for existing PR
159196 if : steps.should-run.outputs.skip != 'true' && steps.compare.outputs.needs_update == 'true'
197+ id : existing-pr
198+ env :
199+ GH_TOKEN : ${{ github.token }}
200+ run : |
201+ # Check if a PR already exists for this package update
202+ BRANCH="pkg-update/${{ matrix.package }}-${{ steps.upstream.outputs.version }}"
203+ EXISTING=$(gh pr list --head "$BRANCH" --json number --jq '.[0].number' 2>/dev/null) || EXISTING=""
204+
205+ if [ -n "$EXISTING" ]; then
206+ echo "PR #$EXISTING already exists for ${{ matrix.package }} ${{ steps.upstream.outputs.version }}"
207+ echo "exists=true" >> $GITHUB_OUTPUT
208+ else
209+ echo "No existing PR found"
210+ echo "exists=false" >> $GITHUB_OUTPUT
211+ fi
212+
213+ - name : Update spec file
214+ if : steps.should-run.outputs.skip != 'true' && steps.compare.outputs.needs_update == 'true' && steps.existing-pr.outputs.exists != 'true'
160215 run : |
161216 SPEC_FILE="packages/${{ matrix.package }}/${{ matrix.package }}.spec"
162217 OLD_VERSION="${{ steps.spec.outputs.version }}"
@@ -178,7 +233,7 @@ jobs:
178233 echo "Updated ${{ matrix.package }} from $OLD_VERSION to $NEW_VERSION"
179234
180235 - name : Create Pull Request
181- if : steps.should-run.outputs.skip != 'true' && steps.compare.outputs.needs_update == 'true'
236+ if : steps.should-run.outputs.skip != 'true' && steps.compare.outputs.needs_update == 'true' && steps.existing-pr.outputs.exists != 'true'
182237 uses : peter-evans/create-pull-request@v7
183238 with :
184239 token : ${{ secrets.GITHUB_TOKEN }}
0 commit comments