Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 23 additions & 7 deletions .github/scripts/skia-sync-push-prs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,11 @@ SS_SUMMARY=""
[ -f /tmp/gh-aw/agent/skia-sync-skiasharp-summary.md ] && SS_SUMMARY=$(cat /tmp/gh-aw/agent/skia-sync-skiasharp-summary.md)

# --- Determine PR titles based on sync kind (tip / same-milestone / milestone bump) ---
# Every skia-sync PR gets the `type/milestone-sync` label. The one case that also
# changes the `libSkiaSharp milestone` line in scripts/VERSIONS.txt additionally gets
# the `type/milestone-bump` label.
SS_IS_MILESTONE_BUMP=false
# Every skia-sync PR (in both mono/skia and mono/SkiaSharp) gets the `type/milestone-sync`
# label. The one case that advances the milestone number — i.e. changes `SK_MILESTONE` in
# mono/skia's include/core/SkMilestone.h and the `libSkiaSharp milestone` line in
# mono/SkiaSharp's scripts/VERSIONS.txt — additionally gets the `type/milestone-bump` label.
IS_MILESTONE_BUMP=false
if [ "$UPSTREAM_REF" = "main" ]; then
SS_TITLE="[skia-sync] Merge upstream Skia main (tip)"
SS_BODY_INTRO="Automated bleeding-edge sync from the tip of upstream Skia (google/skia main)."
Expand All @@ -59,7 +60,7 @@ elif [ "$CURRENT" = "$TARGET" ]; then
else
SS_TITLE="[skia-sync] Update skia to milestone ${TARGET}"
SS_BODY_INTRO="Automated Skia milestone bump from m${CURRENT} to m${TARGET}."
SS_IS_MILESTONE_BUMP=true
IS_MILESTONE_BUMP=true
fi
if [ "$IS_RELEASE" = "true" ]; then
SS_BODY_INTRO="${SS_BODY_INTRO} Targeting release branch \`${SS_BASE}\` (mono/skia \`${SKIA_BASE}\`)."
Expand Down Expand Up @@ -90,19 +91,34 @@ push_skia() {

local pr
pr=$(gh pr list --repo mono/skia --head "$BRANCH" --state open --json number --jq '.[0].number' 2>/dev/null || echo "")

# Every skia-sync PR carries type/milestone-sync; milestone bumps (those that change
# SK_MILESTONE in include/core/SkMilestone.h) additionally carry type/milestone-bump.
# Both labels must already exist in the repo.
local skia_label_args=(--label "type/milestone-sync")
if [ "$IS_MILESTONE_BUMP" = "true" ]; then
skia_label_args+=(--label "type/milestone-bump")
fi

if [ -z "$pr" ]; then
echo "Creating mono/skia PR..."
gh pr create --repo mono/skia \
--head "$BRANCH" --base "$SKIA_BASE" \
--title "$SKIA_TITLE" \
--draft \
"${skia_label_args[@]}" \
--body "${SKIA_BODY_INTRO}

${SKIA_SUMMARY}

Created by ${WORKFLOW_LINK}." || echo "::warning::Failed to create mono/skia PR"
else
echo "Updating mono/skia PR #${pr}..."
local skia_add_labels="type/milestone-sync"
if [ "$IS_MILESTONE_BUMP" = "true" ]; then
skia_add_labels="type/milestone-sync,type/milestone-bump"
fi
gh pr edit "$pr" --repo mono/skia --add-label "$skia_add_labels" || true
gh pr edit "$pr" --repo mono/skia \
--body "${SKIA_BODY_INTRO}

Expand Down Expand Up @@ -135,7 +151,7 @@ push_skiasharp() {
# the milestone in scripts/VERSIONS.txt) additionally carry type/milestone-bump. Both
# labels must already exist in the repo.
local ss_label_args=(--label "type/milestone-sync")
if [ "$SS_IS_MILESTONE_BUMP" = "true" ]; then
if [ "$IS_MILESTONE_BUMP" = "true" ]; then
ss_label_args+=(--label "type/milestone-bump")
fi

Expand All @@ -156,7 +172,7 @@ Created by ${WORKFLOW_LINK}." || echo "::warning::Failed to create mono/SkiaShar
else
echo "Updating mono/SkiaSharp PR #${ss_pr}..."
local ss_add_labels="type/milestone-sync"
if [ "$SS_IS_MILESTONE_BUMP" = "true" ]; then
if [ "$IS_MILESTONE_BUMP" = "true" ]; then
ss_add_labels="type/milestone-sync,type/milestone-bump"
fi
gh pr edit "$ss_pr" --repo mono/SkiaSharp --add-label "$ss_add_labels" || true
Expand Down
Loading