From 8cd160b3e33ceffefb8444fef67a0db5179efe78 Mon Sep 17 00:00:00 2001 From: Khang Vu Date: Tue, 3 Mar 2026 14:12:48 -0800 Subject: [PATCH 01/28] upstream sync workflow --- .github/workflows/upstream-sync.yml | 207 +++++++++++++++++++++++++++- 1 file changed, 206 insertions(+), 1 deletion(-) diff --git a/.github/workflows/upstream-sync.yml b/.github/workflows/upstream-sync.yml index bf636b19d..f3db1f469 100644 --- a/.github/workflows/upstream-sync.yml +++ b/.github/workflows/upstream-sync.yml @@ -19,4 +19,209 @@ jobs: uses: actions/create-github-app-token@v1 with: app-id: ${{ secrets.SYNC_APP_ID }} - private-key: ${{ secrets.SYNC_APP_PRIVATE_KEY }} \ No newline at end of file + private-key: ${{ secrets.SYNC_APP_PRIVATE_KEY }} + + # ── 1. Checkout master ──────────────────────────────────────────────── + - name: Checkout master + uses: actions/checkout@v4 + with: + ref: master + fetch-depth: 0 + token: ${{ steps.app_token.outputs.token }} + + # ── 2. Read current Prebid version from package.json ────────────────── + - name: Read current Prebid version + id: current_version + run: | + PREBID_VERSION=$(jq -r '.version' package.json) + echo "version=$PREBID_VERSION" >> $GITHUB_OUTPUT + echo "Current Prebid version in package.json: $PREBID_VERSION" + + # ── 3. Fetch all upstream tags and find the next greater version ─────── + - name: Fetch latest upstream Prebid.js tag + id: latest_tag + run: | + CURRENT="${{ steps.current_version.outputs.version }}" + CLEAN="${CURRENT#v}" + + git fetch https://github.com/prebid/Prebid.js.git --tags + + # Walk sorted tags after current version and return the first greater one + FOUND_TAG=$(git tag -l \ + | grep -E '^v?[0-9]+\.[0-9]+\.[0-9]+$' \ + | sort -V \ + | awk -v cur="$CLEAN" ' + { + tag = $0 + v = tag + sub(/^v/, "", v) + if (found) { + n = split(v, a, ".") + m = split(cur, b, ".") + for (i = 1; i <= 3; i++) { + if ((a[i]+0) > (b[i]+0)) { print tag; exit } + if ((a[i]+0) < (b[i]+0)) break + } + } + if (v == cur) found = 1 + } + ' | head -1) + + if [ -n "$FOUND_TAG" ]; then + echo "tag=$FOUND_TAG" >> $GITHUB_OUTPUT + echo "Next greater tag after $CURRENT: $FOUND_TAG" + else + echo "tag=" >> $GITHUB_OUTPUT + echo "No greater tag found after $CURRENT — already up to date." + fi + + # ── 4. Check if a next tag was found ────────────────────────────────── + - name: Check if update is needed + id: version_check + run: | + LATEST="${{ steps.latest_tag.outputs.tag }}" + + if [ -n "$LATEST" ]; then + echo "needs_update=true" >> $GITHUB_OUTPUT + echo "✅ New tag found ($LATEST). Will attempt sync." + else + echo "needs_update=false" >> $GITHUB_OUTPUT + echo "⏭️ Already up to date. Skipping." + fi + + # ── 5. Add upstream remote & fetch ──────────────────────────────────── + - name: Add upstream remote + if: steps.version_check.outputs.needs_update == 'true' + run: | + git remote add upstream https://github.com/prebid/Prebid.js.git + git fetch upstream --tags + + # ── 6. Get commit range between current tag and latest tag ──────────── + - name: Get commit range + if: steps.version_check.outputs.needs_update == 'true' + id: commit_range + run: | + CURRENT_TAG="${{ steps.current_version.outputs.version }}" + LATEST_TAG="${{ steps.latest_tag.outputs.tag }}" + + if git rev-parse "$CURRENT_TAG" >/dev/null 2>&1; then + FROM_REF="$CURRENT_TAG" + elif git rev-parse "v$CURRENT_TAG" >/dev/null 2>&1; then + FROM_REF="v$CURRENT_TAG" + else + echo "❌ Cannot resolve current tag '$CURRENT_TAG' in upstream history." + exit 1 + fi + + COMMITS=$(git log --oneline "$FROM_REF".."$LATEST_TAG" --reverse | awk '{print $1}') + echo "Commits to process:" + echo "$COMMITS" + + echo "$COMMITS" > /tmp/commits_to_process.txt + COUNT=$(echo "$COMMITS" | grep -c . || true) + echo "count=$COUNT" >> $GITHUB_OUTPUT + + # ── 7. Cherry-pick commits (skip adapter commits) ───────────────────── + - name: Apply upstream commits + if: steps.version_check.outputs.needs_update == 'true' + id: apply_commits + run: | + LATEST_TAG="${{ steps.latest_tag.outputs.tag }}" + BRANCH="prebid-sync-${LATEST_TAG}" + + APP_SLUG=$(curl -s -H "Authorization: Bearer ${{ steps.app_token.outputs.token }}" \ + https://api.github.com/app | jq -r '.slug') + git config user.name "${APP_SLUG}[bot]" + git config user.email "${{ secrets.SYNC_APP_ID }}+${APP_SLUG}[bot]@users.noreply.github.com" + + git checkout -b "$BRANCH" + + SKIPPED_FILE="/tmp/skipped_commits.txt" + FAILED_FILE="/tmp/failed_commits.txt" + APPLIED_FILE="/tmp/applied_commits.txt" + touch "$SKIPPED_FILE" "$FAILED_FILE" "$APPLIED_FILE" + + while IFS= read -r HASH; do + [ -z "$HASH" ] && continue + + SUBJECT=$(git log --format="%s" -n 1 "$HASH") + + # ── Skip adapter commits ───────────────────────────────────── + if echo "$SUBJECT" | grep -qiE "adapter"; then + echo "⏭️ SKIPPED (adapter) [$HASH] $SUBJECT" + echo "$HASH | $SUBJECT" >> "$SKIPPED_FILE" + continue + fi + + # ── Skip commits where all changes are only in .github/ ────── + CHANGED_FILES=$(git diff-tree --no-commit-id -r --name-only "$HASH") + NON_WORKFLOW=$(echo "$CHANGED_FILES" | grep -v '^\.github/' || true) + if [ -z "$NON_WORKFLOW" ]; then + echo "⏭️ SKIPPED (workflow only) [$HASH] $SUBJECT" + echo "$HASH | $SUBJECT" >> "$SKIPPED_FILE" + continue + fi + + # ── Attempt cherry-pick ────────────────────────────────────── + if git cherry-pick --allow-empty "$HASH" 2>/dev/null; then + echo "✅ APPLIED [$HASH] $SUBJECT" + echo "$HASH | $SUBJECT" >> "$APPLIED_FILE" + else + echo "❌ CONFLICT [$HASH] $SUBJECT" + echo "$HASH | $SUBJECT" >> "$FAILED_FILE" + git cherry-pick --abort 2>/dev/null || true + fi + done < /tmp/commits_to_process.txt + + echo "branch=$BRANCH" >> $GITHUB_OUTPUT + + echo "" + echo "━━━ Summary ━━━" + echo "Applied : $(wc -l < $APPLIED_FILE)" + echo "Skipped : $(wc -l < $SKIPPED_FILE)" + echo "Conflicts: $(wc -l < $FAILED_FILE)" + + # ── 8. Push sync branch ─────────────────────────────────────────────── + - name: Push sync branch + if: steps.version_check.outputs.needs_update == 'true' + run: | + git push origin "${{ steps.apply_commits.outputs.branch }}" + + # ── 9. Open Pull Request with full report ───────────────────────────── + - name: Create Pull Request + if: steps.version_check.outputs.needs_update == 'true' + env: + GH_TOKEN: ${{ steps.app_token.outputs.token }} + run: | + CURRENT="${{ steps.current_version.outputs.version }}" + LATEST="${{ steps.latest_tag.outputs.tag }}" + BRANCH="${{ steps.apply_commits.outputs.branch }}" + + BODY="## Prebid.js Sync: \`$CURRENT\` → \`$LATEST\` + + This PR was auto-generated by the **Sync with Upstream Prebid.js** workflow. + + ### ✅ Applied Commits + \`\`\` + $(cat /tmp/applied_commits.txt || echo 'none') + \`\`\` + + ### ⏭️ Skipped Commits (adapter) + These commits were intentionally skipped because their subject contains \`adapter\`: + \`\`\` + $(cat /tmp/skipped_commits.txt || echo 'none') + \`\`\` + + ### ❌ Conflicting Commits (require manual resolution) + \`\`\` + $(cat /tmp/failed_commits.txt || echo 'none') + \`\`\` + + > **Upstream diff:** https://github.com/prebid/Prebid.js/compare/$CURRENT...$LATEST" + + gh pr create \ + --title "chore: sync Prebid.js $CURRENT → $LATEST" \ + --body "$BODY" \ + --base main \ + --head "$BRANCH" \ + --label "prebid-sync" \ No newline at end of file From de0cef5ce014958fab09118a044a62c65e5eacae Mon Sep 17 00:00:00 2001 From: Khang Vu Date: Tue, 3 Mar 2026 16:37:13 -0800 Subject: [PATCH 02/28] add better skipping commit checks and bump prebid version ourselves to avoid merge conflicts everytime --- .github/workflows/upstream-sync.yml | 44 ++++++++++++++++++++++------- 1 file changed, 34 insertions(+), 10 deletions(-) diff --git a/.github/workflows/upstream-sync.yml b/.github/workflows/upstream-sync.yml index f3db1f469..06499bf19 100644 --- a/.github/workflows/upstream-sync.yml +++ b/.github/workflows/upstream-sync.yml @@ -1,5 +1,7 @@ name: Upstream Sync +name: Sync with Upstream Prebid.js + on: schedule: - cron: '0 6 * * 1' # Weekly on Monday at 06:00 UTC @@ -146,18 +148,25 @@ jobs: SUBJECT=$(git log --format="%s" -n 1 "$HASH") - # ── Skip adapter commits ───────────────────────────────────── - if echo "$SUBJECT" | grep -qiE "adapter"; then - echo "⏭️ SKIPPED (adapter) [$HASH] $SUBJECT" + # ── Skip version increment pre-release commits ─────────────── + LATEST_TAG_CLEAN="${LATEST_TAG#v}" + if echo "$SUBJECT" | grep -qiE "^Increment version to ${LATEST_TAG_CLEAN}-pre$"; then + echo "⏭️ SKIPPED (version increment) [$HASH] $SUBJECT" + echo "$HASH | $SUBJECT" >> "$SKIPPED_FILE" + continue + fi + + # ── Skip release commits ───────────────────────────────────── + if echo "$SUBJECT" | grep -qiE "^Prebid ${LATEST_TAG_CLEAN} release$"; then + echo "⏭️ SKIPPED (release commit) [$HASH] $SUBJECT" echo "$HASH | $SUBJECT" >> "$SKIPPED_FILE" continue fi - # ── Skip commits where all changes are only in .github/ ────── - CHANGED_FILES=$(git diff-tree --no-commit-id -r --name-only "$HASH") - NON_WORKFLOW=$(echo "$CHANGED_FILES" | grep -v '^\.github/' || true) - if [ -z "$NON_WORKFLOW" ]; then - echo "⏭️ SKIPPED (workflow only) [$HASH] $SUBJECT" + # ── Skip commits that touch any *BidAdapter* file ──────────── + BID_ADAPTER_FILES=$(git diff-tree --no-commit-id -r --name-only "$HASH" | grep -i "BidAdapter" || true) + if [ -n "$BID_ADAPTER_FILES" ]; then + echo "⏭️ SKIPPED (BidAdapter files) [$HASH] $SUBJECT" echo "$HASH | $SUBJECT" >> "$SKIPPED_FILE" continue fi @@ -181,13 +190,28 @@ jobs: echo "Skipped : $(wc -l < $SKIPPED_FILE)" echo "Conflicts: $(wc -l < $FAILED_FILE)" - # ── 8. Push sync branch ─────────────────────────────────────────────── + # ── 8. Update package.json Prebid version and reinstall ───────────────────── + - name: Bump version and run npm install + if: steps.version_check.outputs.needs_update == 'true' + run: | + LATEST_TAG="${{ steps.latest_tag.outputs.tag }}" + LATEST_TAG_CLEAN="${LATEST_TAG#v}" + + jq --arg v "$LATEST_TAG_CLEAN" '.version = $v' package.json > package.json.tmp + mv package.json.tmp package.json + + npm install + + git add package.json package-lock.json + git commit -m "Prebid ${LATEST_TAG_CLEAN} release - reautomated" + + # ── 9. Push sync branch ─────────────────────────────────────────────── - name: Push sync branch if: steps.version_check.outputs.needs_update == 'true' run: | git push origin "${{ steps.apply_commits.outputs.branch }}" - # ── 9. Open Pull Request with full report ───────────────────────────── + # ── 10. Open Pull Request with full report ───────────────────────────── - name: Create Pull Request if: steps.version_check.outputs.needs_update == 'true' env: From 8af0a7ca16d0a0d8803b50bec1e09021ad06ca88 Mon Sep 17 00:00:00 2001 From: Khang Vu Date: Tue, 3 Mar 2026 16:38:19 -0800 Subject: [PATCH 03/28] fix yaml error --- .github/workflows/upstream-sync.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/upstream-sync.yml b/.github/workflows/upstream-sync.yml index 06499bf19..a83d0b359 100644 --- a/.github/workflows/upstream-sync.yml +++ b/.github/workflows/upstream-sync.yml @@ -1,7 +1,5 @@ name: Upstream Sync -name: Sync with Upstream Prebid.js - on: schedule: - cron: '0 6 * * 1' # Weekly on Monday at 06:00 UTC From 699f5392451c23d2971e33daec6a275dcac1797d Mon Sep 17 00:00:00 2001 From: Khang Vu Date: Tue, 3 Mar 2026 16:54:19 -0800 Subject: [PATCH 04/28] work flow should be skipped an applied by a dev --- .github/workflows/upstream-sync.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/upstream-sync.yml b/.github/workflows/upstream-sync.yml index a83d0b359..b9397d434 100644 --- a/.github/workflows/upstream-sync.yml +++ b/.github/workflows/upstream-sync.yml @@ -169,6 +169,15 @@ jobs: continue fi + # ── Skip commits where all changes are only in .github/ ────── + CHANGED_FILES=$(git diff-tree --no-commit-id -r --name-only "$HASH") + NON_WORKFLOW=$(echo "$CHANGED_FILES" | grep -v '^\.github/' || true) + if [ -z "$NON_WORKFLOW" ]; then + echo "⏭️ SKIPPED (workflow only) [$HASH] $SUBJECT" + echo "$HASH | $SUBJECT" >> "$SKIPPED_FILE" + continue + fi + # ── Attempt cherry-pick ────────────────────────────────────── if git cherry-pick --allow-empty "$HASH" 2>/dev/null; then echo "✅ APPLIED [$HASH] $SUBJECT" From 2d880bddb331c24d05d2385cbd1afaf0f07613bb Mon Sep 17 00:00:00 2001 From: Khang Vu Date: Tue, 3 Mar 2026 17:02:39 -0800 Subject: [PATCH 05/28] see if the label really is the issue --- .github/workflows/upstream-sync.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/upstream-sync.yml b/.github/workflows/upstream-sync.yml index b9397d434..b8a6f8f7c 100644 --- a/.github/workflows/upstream-sync.yml +++ b/.github/workflows/upstream-sync.yml @@ -254,5 +254,4 @@ jobs: --title "chore: sync Prebid.js $CURRENT → $LATEST" \ --body "$BODY" \ --base main \ - --head "$BRANCH" \ - --label "prebid-sync" \ No newline at end of file + --head "$BRANCH" \ No newline at end of file From 6fa56e2ebebaef6e416a0ff8b29b034944e2ba3b Mon Sep 17 00:00:00 2001 From: Khang Vu Date: Tue, 3 Mar 2026 17:17:52 -0800 Subject: [PATCH 06/28] set owner and repo when creating token --- .github/workflows/upstream-sync.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/upstream-sync.yml b/.github/workflows/upstream-sync.yml index b8a6f8f7c..03c89b991 100644 --- a/.github/workflows/upstream-sync.yml +++ b/.github/workflows/upstream-sync.yml @@ -20,6 +20,8 @@ jobs: with: app-id: ${{ secrets.SYNC_APP_ID }} private-key: ${{ secrets.SYNC_APP_PRIVATE_KEY }} + owner: OpenAds-Auction + repositories: OpenAdsJs # ── 1. Checkout master ──────────────────────────────────────────────── - name: Checkout master @@ -254,4 +256,5 @@ jobs: --title "chore: sync Prebid.js $CURRENT → $LATEST" \ --body "$BODY" \ --base main \ - --head "$BRANCH" \ No newline at end of file + --head "$BRANCH" \ + --label "prebid-sync" \ No newline at end of file From 7c46dffa5b3faafb4d4fc9770b88c44310c1ec5a Mon Sep 17 00:00:00 2001 From: Khang Vu Date: Tue, 3 Mar 2026 17:22:46 -0800 Subject: [PATCH 07/28] remove label again... --- .github/workflows/upstream-sync.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/upstream-sync.yml b/.github/workflows/upstream-sync.yml index 03c89b991..41e1a9701 100644 --- a/.github/workflows/upstream-sync.yml +++ b/.github/workflows/upstream-sync.yml @@ -256,5 +256,4 @@ jobs: --title "chore: sync Prebid.js $CURRENT → $LATEST" \ --body "$BODY" \ --base main \ - --head "$BRANCH" \ - --label "prebid-sync" \ No newline at end of file + --head "$BRANCH" \ No newline at end of file From b03330b2bf1e0bb6c89c0bd37d47203a5b42f067 Mon Sep 17 00:00:00 2001 From: Khang Vu Date: Tue, 3 Mar 2026 17:35:27 -0800 Subject: [PATCH 08/28] is it the body --- .github/workflows/upstream-sync.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/upstream-sync.yml b/.github/workflows/upstream-sync.yml index 41e1a9701..4657dd258 100644 --- a/.github/workflows/upstream-sync.yml +++ b/.github/workflows/upstream-sync.yml @@ -254,6 +254,5 @@ jobs: gh pr create \ --title "chore: sync Prebid.js $CURRENT → $LATEST" \ - --body "$BODY" \ --base main \ --head "$BRANCH" \ No newline at end of file From 67e95191b50a407c9dc946198fe242d77ff36d0f Mon Sep 17 00:00:00 2001 From: Khang Vu Date: Tue, 3 Mar 2026 17:38:44 -0800 Subject: [PATCH 09/28] use curl instead --- .github/workflows/upstream-sync.yml | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/workflows/upstream-sync.yml b/.github/workflows/upstream-sync.yml index 4657dd258..2f26d6150 100644 --- a/.github/workflows/upstream-sync.yml +++ b/.github/workflows/upstream-sync.yml @@ -252,7 +252,14 @@ jobs: > **Upstream diff:** https://github.com/prebid/Prebid.js/compare/$CURRENT...$LATEST" - gh pr create \ - --title "chore: sync Prebid.js $CURRENT → $LATEST" \ - --base main \ - --head "$BRANCH" \ No newline at end of file + curl -s -X POST \ + -H "Authorization: Bearer ${{ steps.app_token.outputs.token }}" \ + -H "Accept: application/vnd.github+json" \ + https://api.github.com/repos/${{ github.repository }}/pulls \ + -d "{ + \"title\": \"chore: sync Prebid.js $CURRENT → $LATEST\", + \"body\": $(echo "$BODY" | jq -Rs .), + \"head\": \"$BRANCH\", + \"base\": \"master\", + \"labels\": [\"prebid-sync\"] + }" \ No newline at end of file From 6258271c9d5fa8f80c9829ccba7623145fb35312 Mon Sep 17 00:00:00 2001 From: Khang Vu Date: Tue, 3 Mar 2026 18:02:37 -0800 Subject: [PATCH 10/28] append url links to prs --- .github/workflows/upstream-sync.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/upstream-sync.yml b/.github/workflows/upstream-sync.yml index 2f26d6150..36423b7e9 100644 --- a/.github/workflows/upstream-sync.yml +++ b/.github/workflows/upstream-sync.yml @@ -163,6 +163,13 @@ jobs: continue fi + # ── Replace (#NUMBER) with a Prebid.js PR link ─────────────── + PR_REF=$(echo "$SUBJECT" | grep -oE '\(#[0-9]+\)$' | grep -oE '[0-9]+' || true) + if [ -n "$PR_REF" ]; then + SUBJECT=$(echo "$SUBJECT" | sed "s/(#${PR_REF})$//") + SUBJECT="${SUBJECT}[#${PR_REF}](https://github.com/prebid/Prebid.js/pull/${PR_REF})" + fi + # ── Skip commits that touch any *BidAdapter* file ──────────── BID_ADAPTER_FILES=$(git diff-tree --no-commit-id -r --name-only "$HASH" | grep -i "BidAdapter" || true) if [ -n "$BID_ADAPTER_FILES" ]; then @@ -257,7 +264,7 @@ jobs: -H "Accept: application/vnd.github+json" \ https://api.github.com/repos/${{ github.repository }}/pulls \ -d "{ - \"title\": \"chore: sync Prebid.js $CURRENT → $LATEST\", + \"title\": \"sync Prebid.js $CURRENT → $LATEST\", \"body\": $(echo "$BODY" | jq -Rs .), \"head\": \"$BRANCH\", \"base\": \"master\", From a89ec09e4b925649edf3a781adf8f0cfe14d3378 Mon Sep 17 00:00:00 2001 From: Khang Vu Date: Tue, 3 Mar 2026 18:07:51 -0800 Subject: [PATCH 11/28] dont place them in a code block so they urls are clickalbe --- .github/workflows/upstream-sync.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.github/workflows/upstream-sync.yml b/.github/workflows/upstream-sync.yml index 36423b7e9..ea3cfe4be 100644 --- a/.github/workflows/upstream-sync.yml +++ b/.github/workflows/upstream-sync.yml @@ -242,20 +242,14 @@ jobs: This PR was auto-generated by the **Sync with Upstream Prebid.js** workflow. ### ✅ Applied Commits - \`\`\` $(cat /tmp/applied_commits.txt || echo 'none') - \`\`\` ### ⏭️ Skipped Commits (adapter) These commits were intentionally skipped because their subject contains \`adapter\`: - \`\`\` $(cat /tmp/skipped_commits.txt || echo 'none') - \`\`\` ### ❌ Conflicting Commits (require manual resolution) - \`\`\` $(cat /tmp/failed_commits.txt || echo 'none') - \`\`\` > **Upstream diff:** https://github.com/prebid/Prebid.js/compare/$CURRENT...$LATEST" From 3bb2e76a091535e95edee5e1bd245cdba158b465 Mon Sep 17 00:00:00 2001 From: Khang Vu Date: Tue, 3 Mar 2026 18:14:12 -0800 Subject: [PATCH 12/28] use bullet points --- .github/workflows/upstream-sync.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/upstream-sync.yml b/.github/workflows/upstream-sync.yml index ea3cfe4be..b6d5198a6 100644 --- a/.github/workflows/upstream-sync.yml +++ b/.github/workflows/upstream-sync.yml @@ -240,18 +240,17 @@ jobs: BODY="## Prebid.js Sync: \`$CURRENT\` → \`$LATEST\` This PR was auto-generated by the **Sync with Upstream Prebid.js** workflow. + > **Upstream diff:** https://github.com/prebid/Prebid.js/compare/$CURRENT...$LATEST ### ✅ Applied Commits - $(cat /tmp/applied_commits.txt || echo 'none') + $(format_list /tmp/applied_commits.txt) ### ⏭️ Skipped Commits (adapter) - These commits were intentionally skipped because their subject contains \`adapter\`: - $(cat /tmp/skipped_commits.txt || echo 'none') + These commits were intentionally skipped because they made changes to files matching \`BidAdapter\`: + $(format_list /tmp/skipped_commits.txt) ### ❌ Conflicting Commits (require manual resolution) - $(cat /tmp/failed_commits.txt || echo 'none') - - > **Upstream diff:** https://github.com/prebid/Prebid.js/compare/$CURRENT...$LATEST" + $(format_list /tmp/failed_commits.txt) curl -s -X POST \ -H "Authorization: Bearer ${{ steps.app_token.outputs.token }}" \ From 3d07ac3ae97e243384a8ded013d08b9d57cf7f7a Mon Sep 17 00:00:00 2001 From: Khang Vu Date: Tue, 3 Mar 2026 18:17:35 -0800 Subject: [PATCH 13/28] need command --- .github/workflows/upstream-sync.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/upstream-sync.yml b/.github/workflows/upstream-sync.yml index b6d5198a6..b9caf0b51 100644 --- a/.github/workflows/upstream-sync.yml +++ b/.github/workflows/upstream-sync.yml @@ -237,6 +237,17 @@ jobs: LATEST="${{ steps.latest_tag.outputs.tag }}" BRANCH="${{ steps.apply_commits.outputs.branch }}" + format_list() { + local file=$1 + if [ -s "$file" ]; then + while IFS= read -r line; do + echo "- $line" + done < "$file" + else + echo "- none" + fi + } + BODY="## Prebid.js Sync: \`$CURRENT\` → \`$LATEST\` This PR was auto-generated by the **Sync with Upstream Prebid.js** workflow. From 8f2d5f81f07c3b38135e46b8a3f6b2a2faa39299 Mon Sep 17 00:00:00 2001 From: Khang Vu Date: Tue, 3 Mar 2026 18:22:04 -0800 Subject: [PATCH 14/28] missing closing quotation --- .github/workflows/upstream-sync.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/upstream-sync.yml b/.github/workflows/upstream-sync.yml index b9caf0b51..917dbfd92 100644 --- a/.github/workflows/upstream-sync.yml +++ b/.github/workflows/upstream-sync.yml @@ -227,11 +227,9 @@ jobs: run: | git push origin "${{ steps.apply_commits.outputs.branch }}" - # ── 10. Open Pull Request with full report ───────────────────────────── + # ── 10. Open Pull Request with full report ──────────────────────────── - name: Create Pull Request if: steps.version_check.outputs.needs_update == 'true' - env: - GH_TOKEN: ${{ steps.app_token.outputs.token }} run: | CURRENT="${{ steps.current_version.outputs.version }}" LATEST="${{ steps.latest_tag.outputs.tag }}" @@ -251,6 +249,7 @@ jobs: BODY="## Prebid.js Sync: \`$CURRENT\` → \`$LATEST\` This PR was auto-generated by the **Sync with Upstream Prebid.js** workflow. + > **Upstream diff:** https://github.com/prebid/Prebid.js/compare/$CURRENT...$LATEST ### ✅ Applied Commits @@ -261,14 +260,14 @@ jobs: $(format_list /tmp/skipped_commits.txt) ### ❌ Conflicting Commits (require manual resolution) - $(format_list /tmp/failed_commits.txt) + $(format_list /tmp/failed_commits.txt)" curl -s -X POST \ -H "Authorization: Bearer ${{ steps.app_token.outputs.token }}" \ -H "Accept: application/vnd.github+json" \ https://api.github.com/repos/${{ github.repository }}/pulls \ -d "{ - \"title\": \"sync Prebid.js $CURRENT → $LATEST\", + \"title\": \"chore: sync Prebid.js $CURRENT → $LATEST\", \"body\": $(echo "$BODY" | jq -Rs .), \"head\": \"$BRANCH\", \"base\": \"master\", From 748c3d9dfed8970b18269da62cc891ed3d050815 Mon Sep 17 00:00:00 2001 From: Khang Vu Date: Tue, 3 Mar 2026 18:31:56 -0800 Subject: [PATCH 15/28] add the commit to list made by the upstrea sync bot --- .github/workflows/upstream-sync.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/upstream-sync.yml b/.github/workflows/upstream-sync.yml index 917dbfd92..e07aa2d4b 100644 --- a/.github/workflows/upstream-sync.yml +++ b/.github/workflows/upstream-sync.yml @@ -152,14 +152,14 @@ jobs: LATEST_TAG_CLEAN="${LATEST_TAG#v}" if echo "$SUBJECT" | grep -qiE "^Increment version to ${LATEST_TAG_CLEAN}-pre$"; then echo "⏭️ SKIPPED (version increment) [$HASH] $SUBJECT" - echo "$HASH | $SUBJECT" >> "$SKIPPED_FILE" + echo "$HASH | $SUBJECT (unneeded changes)" >> "$SKIPPED_FILE" continue fi # ── Skip release commits ───────────────────────────────────── if echo "$SUBJECT" | grep -qiE "^Prebid ${LATEST_TAG_CLEAN} release$"; then echo "⏭️ SKIPPED (release commit) [$HASH] $SUBJECT" - echo "$HASH | $SUBJECT" >> "$SKIPPED_FILE" + echo "$HASH | $SUBJECT (will cause merge conflicts)" >> "$SKIPPED_FILE" continue fi @@ -219,7 +219,8 @@ jobs: npm install git add package.json package-lock.json - git commit -m "Prebid ${LATEST_TAG_CLEAN} release - reautomated" + SYNC_HASH=$(git commit -m "Prebid ${LATEST_TAG_CLEAN} release - reautomated" | grep -oE '[0-9a-f]{7,}' | head -1) + echo "$SYNC_HASH | Prebid Version Update (OpenAds Upstream Sync Bot)" >> /tmp/applied_commits.txt # ── 9. Push sync branch ─────────────────────────────────────────────── - name: Push sync branch From aa91e90767d7c9fd144de0b8009711e72c846e64 Mon Sep 17 00:00:00 2001 From: Khang Vu Date: Wed, 4 Mar 2026 10:53:44 -0800 Subject: [PATCH 16/28] link prebid release page --- .github/workflows/upstream-sync.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/upstream-sync.yml b/.github/workflows/upstream-sync.yml index e07aa2d4b..6e27557c2 100644 --- a/.github/workflows/upstream-sync.yml +++ b/.github/workflows/upstream-sync.yml @@ -250,7 +250,7 @@ jobs: BODY="## Prebid.js Sync: \`$CURRENT\` → \`$LATEST\` This PR was auto-generated by the **Sync with Upstream Prebid.js** workflow. - + [Prebid $LATEST Release Page](https://github.com/prebid/Prebid.js/releases/tag/$LATEST) > **Upstream diff:** https://github.com/prebid/Prebid.js/compare/$CURRENT...$LATEST ### ✅ Applied Commits From 1f0bf02323ea269ed5363ebc3c7ba4b7ab110f60 Mon Sep 17 00:00:00 2001 From: Khang Vu Date: Wed, 4 Mar 2026 11:20:28 -0800 Subject: [PATCH 17/28] check that current PR has not already been created --- .github/workflows/upstream-sync.yml | 52 +++++++++++++++++++++-------- 1 file changed, 38 insertions(+), 14 deletions(-) diff --git a/.github/workflows/upstream-sync.yml b/.github/workflows/upstream-sync.yml index 6e27557c2..f18035b07 100644 --- a/.github/workflows/upstream-sync.yml +++ b/.github/workflows/upstream-sync.yml @@ -91,16 +91,40 @@ jobs: echo "⏭️ Already up to date. Skipping." fi - # ── 5. Add upstream remote & fetch ──────────────────────────────────── - - name: Add upstream remote + # ── 5. Check if PR already exists ───────────────────────────────────── + - name: Check for existing PR if: steps.version_check.outputs.needs_update == 'true' + id: pr_check + run: | + CURRENT="${{ steps.current_version.outputs.version }}" + LATEST="${{ steps.latest_tag.outputs.tag }}" + PR_TITLE="chore: sync Prebid.js $CURRENT → $LATEST" + + EXISTING=$(curl -s \ + -H "Authorization: Bearer ${{ steps.app_token.outputs.token }}" \ + -H "Accept: application/vnd.github+json" \ + "https://api.github.com/repos/${{ github.repository }}/pulls?state=open&per_page=100" \ + | jq -r '.[].title' \ + | grep -qF "$PR_TITLE" && echo "true" || echo "false") + + echo "exists=$EXISTING" >> $GITHUB_OUTPUT + + if [ "$EXISTING" = "true" ]; then + echo "⏭️ PR already exists for '$PR_TITLE'. Skipping." + else + echo "✅ No existing PR found. Proceeding." + fi + + # ── 6. Add upstream remote & fetch ──────────────────────────────────── + - name: Add upstream remote + if: steps.version_check.outputs.needs_update == 'true' && steps.pr_check.outputs.exists == 'false' run: | git remote add upstream https://github.com/prebid/Prebid.js.git git fetch upstream --tags - # ── 6. Get commit range between current tag and latest tag ──────────── + # ── 7. Get commit range between current tag and latest tag ──────────── - name: Get commit range - if: steps.version_check.outputs.needs_update == 'true' + if: steps.version_check.outputs.needs_update == 'true' && steps.pr_check.outputs.exists == 'false' id: commit_range run: | CURRENT_TAG="${{ steps.current_version.outputs.version }}" @@ -123,12 +147,13 @@ jobs: COUNT=$(echo "$COMMITS" | grep -c . || true) echo "count=$COUNT" >> $GITHUB_OUTPUT - # ── 7. Cherry-pick commits (skip adapter commits) ───────────────────── + # ── 8. Cherry-pick commits (skip adapter, workflow-only, and release commits) ── - name: Apply upstream commits - if: steps.version_check.outputs.needs_update == 'true' + if: steps.version_check.outputs.needs_update == 'true' && steps.pr_check.outputs.exists == 'false' id: apply_commits run: | LATEST_TAG="${{ steps.latest_tag.outputs.tag }}" + LATEST_TAG_CLEAN="${LATEST_TAG#v}" BRANCH="prebid-sync-${LATEST_TAG}" APP_SLUG=$(curl -s -H "Authorization: Bearer ${{ steps.app_token.outputs.token }}" \ @@ -149,7 +174,6 @@ jobs: SUBJECT=$(git log --format="%s" -n 1 "$HASH") # ── Skip version increment pre-release commits ─────────────── - LATEST_TAG_CLEAN="${LATEST_TAG#v}" if echo "$SUBJECT" | grep -qiE "^Increment version to ${LATEST_TAG_CLEAN}-pre$"; then echo "⏭️ SKIPPED (version increment) [$HASH] $SUBJECT" echo "$HASH | $SUBJECT (unneeded changes)" >> "$SKIPPED_FILE" @@ -206,9 +230,9 @@ jobs: echo "Skipped : $(wc -l < $SKIPPED_FILE)" echo "Conflicts: $(wc -l < $FAILED_FILE)" - # ── 8. Update package.json Prebid version and reinstall ───────────────────── + # ── 9. Update package.json version and reinstall ────────────────────── - name: Bump version and run npm install - if: steps.version_check.outputs.needs_update == 'true' + if: steps.version_check.outputs.needs_update == 'true' && steps.pr_check.outputs.exists == 'false' run: | LATEST_TAG="${{ steps.latest_tag.outputs.tag }}" LATEST_TAG_CLEAN="${LATEST_TAG#v}" @@ -222,15 +246,15 @@ jobs: SYNC_HASH=$(git commit -m "Prebid ${LATEST_TAG_CLEAN} release - reautomated" | grep -oE '[0-9a-f]{7,}' | head -1) echo "$SYNC_HASH | Prebid Version Update (OpenAds Upstream Sync Bot)" >> /tmp/applied_commits.txt - # ── 9. Push sync branch ─────────────────────────────────────────────── + # ── 10. Push sync branch ────────────────────────────────────────────── - name: Push sync branch - if: steps.version_check.outputs.needs_update == 'true' + if: steps.version_check.outputs.needs_update == 'true' && steps.pr_check.outputs.exists == 'false' run: | git push origin "${{ steps.apply_commits.outputs.branch }}" - # ── 10. Open Pull Request with full report ──────────────────────────── + # ── 11. Open Pull Request with full report ──────────────────────────── - name: Create Pull Request - if: steps.version_check.outputs.needs_update == 'true' + if: steps.version_check.outputs.needs_update == 'true' && steps.pr_check.outputs.exists == 'false' run: | CURRENT="${{ steps.current_version.outputs.version }}" LATEST="${{ steps.latest_tag.outputs.tag }}" @@ -256,7 +280,7 @@ jobs: ### ✅ Applied Commits $(format_list /tmp/applied_commits.txt) - ### ⏭️ Skipped Commits (adapter) + ### ⏭️ Skipped Commits These commits were intentionally skipped because they made changes to files matching \`BidAdapter\`: $(format_list /tmp/skipped_commits.txt) From a5b69a7eede2b37edae6ab59335f317849c78022 Mon Sep 17 00:00:00 2001 From: Khang Vu Date: Wed, 4 Mar 2026 11:31:57 -0800 Subject: [PATCH 18/28] prefix PR with upstream-sync instead of chore --- .github/workflows/upstream-sync.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/upstream-sync.yml b/.github/workflows/upstream-sync.yml index f18035b07..727d3717b 100644 --- a/.github/workflows/upstream-sync.yml +++ b/.github/workflows/upstream-sync.yml @@ -98,7 +98,7 @@ jobs: run: | CURRENT="${{ steps.current_version.outputs.version }}" LATEST="${{ steps.latest_tag.outputs.tag }}" - PR_TITLE="chore: sync Prebid.js $CURRENT → $LATEST" + PR_TITLE="upstream-sync: sync Prebid.js $CURRENT → $LATEST" EXISTING=$(curl -s \ -H "Authorization: Bearer ${{ steps.app_token.outputs.token }}" \ @@ -292,7 +292,7 @@ jobs: -H "Accept: application/vnd.github+json" \ https://api.github.com/repos/${{ github.repository }}/pulls \ -d "{ - \"title\": \"chore: sync Prebid.js $CURRENT → $LATEST\", + \"title\": \"upstream-sync: sync Prebid.js $CURRENT → $LATEST\", \"body\": $(echo "$BODY" | jq -Rs .), \"head\": \"$BRANCH\", \"base\": \"master\", From 9338cc84f382d171f7a30a28f2fcc2b4621053fd Mon Sep 17 00:00:00 2001 From: Khang Vu Date: Wed, 15 Apr 2026 14:56:52 -0700 Subject: [PATCH 19/28] update label and only skip when all files are bidadapter --- .github/workflows/upstream-sync.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/upstream-sync.yml b/.github/workflows/upstream-sync.yml index 727d3717b..a92fcb5da 100644 --- a/.github/workflows/upstream-sync.yml +++ b/.github/workflows/upstream-sync.yml @@ -194,10 +194,11 @@ jobs: SUBJECT="${SUBJECT}[#${PR_REF}](https://github.com/prebid/Prebid.js/pull/${PR_REF})" fi - # ── Skip commits that touch any *BidAdapter* file ──────────── + # ── Skip commits only touch *BidAdapter* file ──────────── BID_ADAPTER_FILES=$(git diff-tree --no-commit-id -r --name-only "$HASH" | grep -i "BidAdapter" || true) - if [ -n "$BID_ADAPTER_FILES" ]; then - echo "⏭️ SKIPPED (BidAdapter files) [$HASH] $SUBJECT" + ALL_FILES=$(git diff-tree --no-commit-id -r --name-only "$HASH") + if [ -n "$BID_ADAPTER_FILES" ] && [ "$BID_ADAPTER_FILES" = "$ALL_FILES" ]; then + echo "⏭️ SKIPPED (BidAdapter files only) [$HASH] $SUBJECT" echo "$HASH | $SUBJECT" >> "$SKIPPED_FILE" continue fi @@ -296,5 +297,5 @@ jobs: \"body\": $(echo "$BODY" | jq -Rs .), \"head\": \"$BRANCH\", \"base\": \"master\", - \"labels\": [\"prebid-sync\"] + \"labels\": [\"upstream-sync\"] }" \ No newline at end of file From 050c2d32b01ab776a198d8a7ae3f1a59834d411b Mon Sep 17 00:00:00 2001 From: Khang Vu Date: Wed, 15 Apr 2026 16:36:16 -0700 Subject: [PATCH 20/28] auto resolve --- .github/workflows/upstream-sync.yml | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/.github/workflows/upstream-sync.yml b/.github/workflows/upstream-sync.yml index a92fcb5da..b46ccffbe 100644 --- a/.github/workflows/upstream-sync.yml +++ b/.github/workflows/upstream-sync.yml @@ -217,9 +217,31 @@ jobs: echo "✅ APPLIED [$HASH] $SUBJECT" echo "$HASH | $SUBJECT" >> "$APPLIED_FILE" else - echo "❌ CONFLICT [$HASH] $SUBJECT" - echo "$HASH | $SUBJECT" >> "$FAILED_FILE" - git cherry-pick --abort 2>/dev/null || true + # Check if all conflicts can be auto-resolved + UNRESOLVED=false + for f in $(git diff --name-only --diff-filter=U); do + if [[ "$f" == *_spec.js ]] && ! git ls-tree HEAD -- "$f" > /dev/null 2>&1; then + # HEAD deleted this _spec.js file — accept the deletion + git rm "$f" 2>/dev/null + elif [[ "$f" == *BidAdapter* ]]; then + # BidAdapter file — take HEAD's version + git checkout HEAD -- "$f" 2>/dev/null + git add "$f" + else + UNRESOLVED=true + fi + done + + if [ "$UNRESOLVED" = false ]; then + # All conflicts were auto-resolved + git -c core.editor=true cherry-pick --continue 2>/dev/null + echo "✅ APPLIED [$HASH] $SUBJECT (auto-resolved)" + echo "$HASH | $SUBJECT" >> "$APPLIED_FILE" + else + echo "❌ CONFLICT [$HASH] $SUBJECT" + echo "$HASH | $SUBJECT" >> "$FAILED_FILE" + git cherry-pick --abort 2>/dev/null || true + fi fi done < /tmp/commits_to_process.txt From e26bde4ede39aa582e44d2e644eb07314732bf9a Mon Sep 17 00:00:00 2001 From: Khang Vu Date: Wed, 15 Apr 2026 16:48:32 -0700 Subject: [PATCH 21/28] logging --- .github/workflows/upstream-sync.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/upstream-sync.yml b/.github/workflows/upstream-sync.yml index b46ccffbe..704f264a0 100644 --- a/.github/workflows/upstream-sync.yml +++ b/.github/workflows/upstream-sync.yml @@ -220,14 +220,18 @@ jobs: # Check if all conflicts can be auto-resolved UNRESOLVED=false for f in $(git diff --name-only --diff-filter=U); do + echo "looking at $f" if [[ "$f" == *_spec.js ]] && ! git ls-tree HEAD -- "$f" > /dev/null 2>&1; then + echo "matched test file, remove" # HEAD deleted this _spec.js file — accept the deletion git rm "$f" 2>/dev/null elif [[ "$f" == *BidAdapter* ]]; then + echo "matched bidapterfile, remove" # BidAdapter file — take HEAD's version git checkout HEAD -- "$f" 2>/dev/null git add "$f" else + echo "matched unresolved" UNRESOLVED=true fi done From 00fa6f6526ed5fa20fe2b4cc4e1efb361c87d1e9 Mon Sep 17 00:00:00 2001 From: Khang Vu Date: Wed, 15 Apr 2026 16:58:27 -0700 Subject: [PATCH 22/28] its just a test haha --- .github/workflows/upstream-sync.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/upstream-sync.yml b/.github/workflows/upstream-sync.yml index 704f264a0..92005efd2 100644 --- a/.github/workflows/upstream-sync.yml +++ b/.github/workflows/upstream-sync.yml @@ -221,7 +221,7 @@ jobs: UNRESOLVED=false for f in $(git diff --name-only --diff-filter=U); do echo "looking at $f" - if [[ "$f" == *_spec.js ]] && ! git ls-tree HEAD -- "$f" > /dev/null 2>&1; then + if [[ "$f" == *_spec.js ]]; then echo "matched test file, remove" # HEAD deleted this _spec.js file — accept the deletion git rm "$f" 2>/dev/null From 19673f455c8ed2ea29fc15fec1f0cb7d43582105 Mon Sep 17 00:00:00 2001 From: Khang Vu Date: Wed, 15 Apr 2026 17:11:15 -0700 Subject: [PATCH 23/28] make srue files don't exist for auto resolve --- .github/workflows/upstream-sync.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/upstream-sync.yml b/.github/workflows/upstream-sync.yml index 92005efd2..46b40f364 100644 --- a/.github/workflows/upstream-sync.yml +++ b/.github/workflows/upstream-sync.yml @@ -221,15 +221,14 @@ jobs: UNRESOLVED=false for f in $(git diff --name-only --diff-filter=U); do echo "looking at $f" - if [[ "$f" == *_spec.js ]]; then + if [[ "$f" == *_spec.js ]] && [ ! -f "$f" ]; then echo "matched test file, remove" # HEAD deleted this _spec.js file — accept the deletion git rm "$f" 2>/dev/null - elif [[ "$f" == *BidAdapter* ]]; then + elif [[ "$f" == *BidAdapter* ]] && [ ! -f "$f" ]; then echo "matched bidapterfile, remove" # BidAdapter file — take HEAD's version - git checkout HEAD -- "$f" 2>/dev/null - git add "$f" + git rm "$f" 2>/dev/null else echo "matched unresolved" UNRESOLVED=true From d430365784759c4d67b7d8b3a434eb032e637470 Mon Sep 17 00:00:00 2001 From: Khang Vu Date: Wed, 15 Apr 2026 17:14:08 -0700 Subject: [PATCH 24/28] test --- .github/workflows/upstream-sync.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/upstream-sync.yml b/.github/workflows/upstream-sync.yml index 46b40f364..bc424c0cd 100644 --- a/.github/workflows/upstream-sync.yml +++ b/.github/workflows/upstream-sync.yml @@ -221,6 +221,7 @@ jobs: UNRESOLVED=false for f in $(git diff --name-only --diff-filter=U); do echo "looking at $f" + -f "$f" if [[ "$f" == *_spec.js ]] && [ ! -f "$f" ]; then echo "matched test file, remove" # HEAD deleted this _spec.js file — accept the deletion From 123bbee202f439eef327e6a52c0688bfea6319da Mon Sep 17 00:00:00 2001 From: Khang Vu Date: Wed, 15 Apr 2026 17:18:59 -0700 Subject: [PATCH 25/28] print --- .github/workflows/upstream-sync.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/upstream-sync.yml b/.github/workflows/upstream-sync.yml index bc424c0cd..d20a748ce 100644 --- a/.github/workflows/upstream-sync.yml +++ b/.github/workflows/upstream-sync.yml @@ -221,7 +221,7 @@ jobs: UNRESOLVED=false for f in $(git diff --name-only --diff-filter=U); do echo "looking at $f" - -f "$f" + if [ -f "$f" ]; then echo "FILE EXISTS: $f"; else echo "FILE MISSING: $f"; fi if [[ "$f" == *_spec.js ]] && [ ! -f "$f" ]; then echo "matched test file, remove" # HEAD deleted this _spec.js file — accept the deletion From 57b5634a553fd16954744eaa8a54c30986ddf7ec Mon Sep 17 00:00:00 2001 From: Khang Vu Date: Wed, 15 Apr 2026 23:57:00 -0700 Subject: [PATCH 26/28] differen file filter --- .github/workflows/upstream-sync.yml | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/.github/workflows/upstream-sync.yml b/.github/workflows/upstream-sync.yml index d20a748ce..4cd31503f 100644 --- a/.github/workflows/upstream-sync.yml +++ b/.github/workflows/upstream-sync.yml @@ -221,15 +221,18 @@ jobs: UNRESOLVED=false for f in $(git diff --name-only --diff-filter=U); do echo "looking at $f" - if [ -f "$f" ]; then echo "FILE EXISTS: $f"; else echo "FILE MISSING: $f"; fi - if [[ "$f" == *_spec.js ]] && [ ! -f "$f" ]; then + HEAD_HAS_FILE=$(git ls-tree -r HEAD --name-only | grep -qxF "$f" && echo "yes" || echo "no") + echo "HEAD has file: $HEAD_HAS_FILE" + if [[ "$f" == *_spec.js ]] && [ "$HEAD_HAS_FILE" = "no" ]; then echo "matched test file, remove" - # HEAD deleted this _spec.js file — accept the deletion git rm "$f" 2>/dev/null - elif [[ "$f" == *BidAdapter* ]] && [ ! -f "$f" ]; then - echo "matched bidapterfile, remove" - # BidAdapter file — take HEAD's version + elif [[ "$f" == *BidAdapter* ]] && [ "$HEAD_HAS_FILE" = "no" ]; then + echo "matched bidadapter file, remove" git rm "$f" 2>/dev/null + elif [[ "$f" == *BidAdapter* ]] && [ "$HEAD_HAS_FILE" = "yes" ]; then + echo "matched bidadapter file, take HEAD version" + git checkout HEAD -- "$f" + git add "$f" else echo "matched unresolved" UNRESOLVED=true From cadf15b8264a12423e7613e1dc4f559c5cafb81f Mon Sep 17 00:00:00 2001 From: Khang Vu Date: Thu, 16 Apr 2026 10:01:41 -0700 Subject: [PATCH 27/28] create lable --- .github/workflows/upstream-sync.yml | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/workflows/upstream-sync.yml b/.github/workflows/upstream-sync.yml index 4cd31503f..904c20ab5 100644 --- a/.github/workflows/upstream-sync.yml +++ b/.github/workflows/upstream-sync.yml @@ -317,7 +317,8 @@ jobs: ### ❌ Conflicting Commits (require manual resolution) $(format_list /tmp/failed_commits.txt)" - curl -s -X POST \ + # Create the PR and capture its number + PR_URL=$(curl -s -X POST \ -H "Authorization: Bearer ${{ steps.app_token.outputs.token }}" \ -H "Accept: application/vnd.github+json" \ https://api.github.com/repos/${{ github.repository }}/pulls \ @@ -325,6 +326,12 @@ jobs: \"title\": \"upstream-sync: sync Prebid.js $CURRENT → $LATEST\", \"body\": $(echo "$BODY" | jq -Rs .), \"head\": \"$BRANCH\", - \"base\": \"master\", - \"labels\": [\"upstream-sync\"] - }" \ No newline at end of file + \"base\": \"master\" + }" | jq -r '.number') + + # Add the label in a separate call + curl -s -X POST \ + -H "Authorization: Bearer ${{ steps.app_token.outputs.token }}" \ + -H "Accept: application/vnd.github+json" \ + https://api.github.com/repos/${{ github.repository }}/issues/$PR_URL/labels \ + -d '{"labels": ["upstream-sync"]}' \ No newline at end of file From 1c563e414df8a67c71944e42ee9136098c9a2eae Mon Sep 17 00:00:00 2001 From: Khang Vu Date: Thu, 16 Apr 2026 11:15:37 -0700 Subject: [PATCH 28/28] mark which ones where auto resolved --- .github/workflows/upstream-sync.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/upstream-sync.yml b/.github/workflows/upstream-sync.yml index 904c20ab5..0bb094daf 100644 --- a/.github/workflows/upstream-sync.yml +++ b/.github/workflows/upstream-sync.yml @@ -243,7 +243,7 @@ jobs: # All conflicts were auto-resolved git -c core.editor=true cherry-pick --continue 2>/dev/null echo "✅ APPLIED [$HASH] $SUBJECT (auto-resolved)" - echo "$HASH | $SUBJECT" >> "$APPLIED_FILE" + echo "$HASH | $SUBJECT (auto-resolved)" >> "$APPLIED_FILE" else echo "❌ CONFLICT [$HASH] $SUBJECT" echo "$HASH | $SUBJECT" >> "$FAILED_FILE"