1010 runs-on : ubuntu-latest
1111 permissions :
1212 contents : write
13+ issues : write
1314
1415 steps :
1516 - name : Checkout default branch (for repo access)
4344 python3 << 'EOF'
4445 import urllib.request
4546 import json
47+ import os
4648 import re
4749
50+ def read_existing_versions():
51+ if not os.path.exists("versions.txt"):
52+ return []
53+
54+ with open("versions.txt", "r") as f:
55+ return [line.strip() for line in f if line.strip()]
56+
57+ def series_key(version):
58+ m = re.match(r'^(\d+)\.(\d+)\.', version)
59+ if not m:
60+ return None
61+
62+ return f"{m.group(1)}.{m.group(2)}"
63+
64+ def major_key(version):
65+ m = re.match(r'^(\d+)\.', version)
66+ return m.group(1) if m else None
67+
4868 def fetch_tags():
4969 tags = []
5070 page = 1
@@ -84,6 +104,10 @@ jobs:
84104 suffix_order = 0 if not suffix else -1
85105 return (major, minor, patch, suffix_order)
86106
107+ old_versions = read_existing_versions()
108+ old_series = {series_key(v) for v in old_versions if series_key(v)}
109+ old_majors = {major_key(v) for v in old_versions if major_key(v)}
110+
87111 tags = fetch_tags()
88112
89113 seen = set()
@@ -99,9 +123,28 @@ jobs:
99123 with open("versions.txt", "w") as f:
100124 f.write("\n".join(versions) + "\n")
101125
126+ new_series = []
127+ if old_versions:
128+ latest_by_series = {}
129+ for version in versions:
130+ series = series_key(version)
131+ if series and series not in old_series and series not in latest_by_series:
132+ latest_by_series[series] = version
133+
134+ for series, representative in sorted(latest_by_series.items(), key=lambda item: [int(part) for part in item[0].split(".")]):
135+ major = series.split(".", 1)[0]
136+ scope = "major" if major not in old_majors else "minor"
137+ new_series.append((scope, series, representative))
138+
139+ with open("new-windows-series.txt", "w") as f:
140+ for scope, series, representative in new_series:
141+ f.write(f"{scope}\t{series}\t{representative}\n")
142+
102143 print(f"Fetched {len(versions)} versions.")
144+ print(f"Detected {len(new_series)} new PHP major/minor series.")
103145 EOF
104146
147+
105148 - name : Commit to cache branch if changed
106149 run : |
107150 git config user.name "github-actions[bot]"
@@ -115,3 +158,59 @@ jobs:
115158 git commit -m "chore: bump php versions cache (+${ADDED} lines)"
116159 git push origin cache
117160 fi
161+
162+ - name : Open Windows installer maintenance issues
163+ env :
164+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
165+ shell : bash
166+ run : |
167+ set -euo pipefail
168+
169+ if [ ! -s new-windows-series.txt ]; then
170+ echo "No new PHP major/minor series detected."
171+ exit 0
172+ fi
173+
174+ while IFS=$'\t' read -r scope series representative; do
175+ [ -n "${series:-}" ] || continue
176+
177+ if [ "$scope" = "major" ]; then
178+ title="Review Windows PHP installer mapping for PHP ${series} (new major)"
179+ else
180+ title="Review Windows PHP installer mapping for PHP ${series}"
181+ fi
182+
183+ existing="$(
184+ ISSUE_TITLE="$title" gh issue list \
185+ --state open \
186+ --search "${title} in:title" \
187+ --json title \
188+ | python3 -c 'import json, os, sys; title = os.environ["ISSUE_TITLE"]; print(sum(1 for issue in json.load(sys.stdin) if issue.get("title") == title))'
189+ )"
190+
191+ if [ "$existing" != "0" ]; then
192+ echo "Issue already exists: $title"
193+ continue
194+ fi
195+
196+ body_file="$(mktemp)"
197+ cat > "$body_file" <<EOF
198+ The PHP versions cache detected a new PHP ${scope} series : ${series}.
199+
200+ First detected version : ${representative}
201+
202+ Please review whether `lib/windows_php.lua` needs to be updated against the official PHP Windows installer script :
203+ https://www.php.net/include/download-instructions/windows.ps1
204+
205+ Focus areas :
206+ - Visual C++ toolset mapping (`vs16`, `vs17`, future values)
207+ - x64/x86 availability and fallback rules
208+ - release vs QA/archive URL behavior
209+ - ZIP naming conventions for NTS Windows builds
210+
211+ This issue was opened automatically by the PHP versions cache workflow because new major/minor PHP series can require Windows installer mapping changes.
212+ EOF
213+
214+ gh issue create --title "$title" --body-file "$body_file"
215+ rm -f "$body_file"
216+ done < new-windows-series.txt
0 commit comments