mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-08-01 19:18:28 -04:00
workflow: enhance porting logic to support inline verbiage & audits
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
name: Port to release branch
|
||||
|
||||
# Ports flagged commits from master onto release/X.Y branches:
|
||||
# - trailer line in a commit message pushed to master; accepted forms:
|
||||
# "Port: 1.5", "Port/1.5", "Port 1.5", "Port - 1.5", "Port: release/1.5"
|
||||
# - "port 1.5" flag in a commit message pushed to master — own line or
|
||||
# mid-line; separators : / - or space; "release/1.5" also accepted;
|
||||
# comma lists ("Port: 1.5, 1.4") work in the own-line form
|
||||
# - "port release/1.5" label on a merged PR
|
||||
# Conflicts are reported to the "Port status: <branch>" tracking issue.
|
||||
|
||||
@@ -55,11 +56,16 @@ jobs:
|
||||
# skip merge commits (handled by the label path)
|
||||
[ "$(git rev-list --no-walk --count --min-parents=2 "$sha")" -eq 0 ] || continue
|
||||
|
||||
# extract targets, then keep only version-shaped ones (X.Y[.Z])
|
||||
targets=$(git log -1 --format=%B "$sha" |
|
||||
# own-line form (supports comma lists), validated version-shaped
|
||||
t1=$(git log -1 --format=%B "$sha" |
|
||||
{ grep -iE '^Port[:/ -]' || true; } | sed -E 's|^port[-:/ ]+||I' | tr ',' '\n' |
|
||||
sed 's/[[:space:]]//g; /^$/d' | sed 's|^release/||I' |
|
||||
{ grep -E '^[0-9]+\.[0-9]+(\.[0-9]+)?$' || true; } | sort -u)
|
||||
{ grep -E '^[0-9]+\.[0-9]+(\.[0-9]+)?$' || true; })
|
||||
# mid-line form, e.g. "fix thing fixes #2802 port 1.5"
|
||||
t2=$(git log -1 --format=%B "$sha" |
|
||||
{ grep -oiE '\bport[-: /]+(release/)?[0-9]+\.[0-9]+(\.[0-9]+)?\b' || true; } |
|
||||
sed -E 's|^port[-:/ ]+||I' | sed 's|^release/||I')
|
||||
targets=$(printf '%s\n%s\n' "$t1" "$t2" | sed '/^$/d' | sort -u)
|
||||
for ver in $targets; do
|
||||
echo "::group::port $sha -> release/$ver"
|
||||
bash scripts/port.sh "release/$ver" "$sha"
|
||||
|
||||
+15
-1
@@ -38,8 +38,12 @@ done < <(git log --format=%B "${BASE}..origin/${TARGET}" 2>/dev/null |
|
||||
# git cherry: "+ sha" = not on target (by patch-id), "- sha" = equivalent exists
|
||||
fixes=""
|
||||
others=""
|
||||
flagged=""
|
||||
fix_count=0
|
||||
other_count=0
|
||||
flagged_count=0
|
||||
VER="${TARGET#release/}"
|
||||
FLAG_RE="\\bport[-: /]+(release/)?${VER//./\\.}\\b"
|
||||
while read -r mark sha; do
|
||||
[ "$mark" = "+" ] || continue
|
||||
[ -n "${PORTED[$sha]:-}" ] && continue
|
||||
@@ -50,7 +54,11 @@ while read -r mark sha; do
|
||||
short=$(git rev-parse --short "$sha")
|
||||
pr=$(grep -oE '#[0-9]+' <<<"$subject" | head -1 || true)
|
||||
line="- [ ] \`${short}\` ${subject} (${author}${pr:+, ${pr}})"
|
||||
if grep -qiE '^(fix|hotfix|bugfix)([(:! ]|$)|^[a-z0-9_-]+: *fix' <<<"$subject"; then
|
||||
# explicit "port X.Y" mention anywhere in the message = strongest signal
|
||||
if git log -1 --format=%B "$sha" | grep -qiE "$FLAG_RE"; then
|
||||
flagged+="${line}"$'\n'
|
||||
flagged_count=$((flagged_count + 1))
|
||||
elif grep -qiE '^(fix|hotfix|bugfix)([(:! ]|$)|^[a-z0-9_./-]+: *fix' <<<"$subject"; then
|
||||
fixes+="${line}"$'\n'
|
||||
fix_count=$((fix_count + 1))
|
||||
else
|
||||
@@ -59,11 +67,17 @@ while read -r mark sha; do
|
||||
fi
|
||||
done < <(git cherry "origin/${TARGET}" origin/master "$BASE")
|
||||
|
||||
FLAGGED_SECTION=""
|
||||
if [ "$flagged_count" -gt 0 ]; then
|
||||
FLAGGED_SECTION="### :warning: Flagged \"port ${VER}\" but not applied (${flagged_count})"$'\n\n'"${flagged}"
|
||||
fi
|
||||
|
||||
REPORT=$(cat <<EOF
|
||||
## Port audit: \`${TARGET}\` vs \`master\`
|
||||
|
||||
Base: \`$(git rev-parse --short "$BASE")\` · generated $(date -u +%Y-%m-%dT%H:%MZ)
|
||||
|
||||
${FLAGGED_SECTION}
|
||||
### Candidate fixes not ported (${fix_count})
|
||||
|
||||
${fixes:-_none — all caught up_ }
|
||||
|
||||
Reference in New Issue
Block a user