Skip to content

Commit 4e3409b

Browse files
committed
ci: only bump ocv-track for ocv PRs
1 parent 0d6be22 commit 4e3409b

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

.github/workflows/sync-upstream.yml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
git fetch upstream dev
2828
git merge --no-edit upstream/dev
2929
30-
- name: Bump ocv track for ocv changes
30+
- name: Bump ocv track for ocv PRs
3131
env:
3232
GH_TOKEN: ${{ secrets.SYNC_PAT }}
3333
run: |
@@ -50,18 +50,22 @@ jobs:
5050
exit 0
5151
fi
5252
53-
changes=$(git log --first-parent --format='%H %s' "$previous"..HEAD | grep -Ev "^[0-9a-f]+ Merge remote-tracking branch 'upstream/dev' into ocv$" || true)
54-
if [ -z "$changes" ]; then
55-
echo "No ocv changes since $previous"
53+
prs=$(mktemp)
54+
git log --first-parent --reverse --format='%H' "$previous"..HEAD | while read -r sha; do
55+
gh api "repos/${{ github.repository }}/commits/$sha/pulls" -q '.[] | select(.base.ref == "ocv") | "#\(.number) \(.title)"' || true
56+
done | awk '!seen[$1]++' > "$prs"
57+
58+
if [ ! -s "$prs" ]; then
59+
echo "No ocv PRs merged since $previous"
5660
exit 0
5761
fi
5862
5963
next="${track%.*}.$((10#${track#*.} + 1))"
6064
printf '%s\n' "$next" > .github/ocv-track
6165
git add .github/ocv-track
6266
git commit -m "release: bump ocv-track"
63-
echo "Bumped ocv track from $track to $next for changes since $previous:"
64-
printf '%s\n' "$changes"
67+
echo "Bumped ocv track from $track to $next for ocv PRs merged since $previous:"
68+
cat "$prs"
6569
6670
- name: Push
6771
run: git push origin ocv

0 commit comments

Comments
 (0)