File tree Expand file tree Collapse file tree 2 files changed +30
-6
lines changed
Expand file tree Collapse file tree 2 files changed +30
-6
lines changed Original file line number Diff line number Diff line change 11name : CLK Rebase
22on :
33 workflow_dispatch :
4+ repository_dispatch :
5+ types :
6+ - stable-branch-updated
47 push :
58 branches :
6- - stable_6.*.y
79 - clk-rebase-ga
810
911jobs :
1416 options : --cpus 8 --privileged
1517 env :
1618 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
17- # For push events, use the branch that triggered the workflow
18- # For manual dispatch, default to stable_6.12.y
19- # STABLE_TRACKING_BRANCH: ${{ github.ref_name || 'stable_6.12.y' }}
20- STABLE_TRACKING_BRANCH : ${{ 'stable_6.12.y' }}
19+ # For repository_dispatch events, use the branch from the payload
20+ # For push/manual dispatch to clk-rebase-ga or workflow_dispatch, default to stable_6.18.y
21+ STABLE_TRACKING_BRANCH : ${{ github.event.client_payload.branch || (startsWith(github.ref_name, 'stable_') && github.ref_name) || 'stable_6.18.y' }}
2122 steps :
2223 - name : Set version variables
2324 run : |
Original file line number Diff line number Diff line change 5454
5555 git remote add upstream ${REMOTE}
5656 git fetch upstream --tags --quiet
57+
58+ # Check if rebase will make changes
59+ BEFORE_SHA=$(git rev-parse HEAD)
5760 git rebase upstream/${REMOTE_BRANCH}
58- git push origin --follow-tags
61+ AFTER_SHA=$(git rev-parse HEAD)
62+
63+ if [ "$BEFORE_SHA" != "$AFTER_SHA" ]; then
64+ echo "Changes detected, pushing..."
65+ git push origin --follow-tags
66+ echo "CHANGES_PUSHED=true" >> $GITHUB_ENV
67+ else
68+ echo "No changes to push"
69+ echo "CHANGES_PUSHED=false" >> $GITHUB_ENV
70+ fi
71+
72+ - name : Trigger CLK rebase workflow
73+ if : env.CHANGES_PUSHED == 'true' && startsWith(matrix.branch, 'stable_')
74+ run : |
75+ curl -L \
76+ -X POST \
77+ -H "Accept: application/vnd.github+json" \
78+ -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
79+ -H "X-GitHub-Api-Version: 2022-11-28" \
80+ https://api.github.com/repos/${{ github.repository }}/dispatches \
81+ -d "{\"event_type\":\"stable-branch-updated\",\"client_payload\":{\"branch\":\"${{ matrix.branch }}\"}}"
5982
6083
You can’t perform that action at this time.
0 commit comments