zabetak commented on code in PR #5136:
URL: https://github.com/apache/calcite/pull/5136#discussion_r3730035359
##########
.github/workflows/publish-non-release-website-updates.yml:
##########
@@ -35,15 +35,33 @@ jobs:
with:
fetch-depth: 0
ref: site
- - name: Cherry pick the commit to site
+ - name: Cherry pick all commits in push to site
+ env:
+ COMMITS: ${{ toJson(github.event.commits) }}
run: |
git config user.email ${{ github.actor }}@users.noreply.github.com
git config user.name ${{ github.actor }}
- git cherry-pick --strategy=recursive -X theirs $GITHUB_SHA
- if [ $? -neq 0 ]; then
- git status | sed -n 's/deleted by us://p' | xargs git add
- git cherry-pick --continue --no-edit
+
+ # github.event.commits is capped at 20 entries. Warn loudly if we hit
Review Comment:
Is there some documentation around the 20 entries limit? I was looking at
https://docs.github.com/en/webhooks/webhook-events-and-payloads#push and there
it says that commits array contains at most 2048 entries.
##########
.github/workflows/publish-non-release-website-updates.yml:
##########
@@ -35,15 +35,33 @@ jobs:
with:
fetch-depth: 0
ref: site
- - name: Cherry pick the commit to site
+ - name: Cherry pick all commits in push to site
+ env:
+ COMMITS: ${{ toJson(github.event.commits) }}
run: |
git config user.email ${{ github.actor }}@users.noreply.github.com
git config user.name ${{ github.actor }}
- git cherry-pick --strategy=recursive -X theirs $GITHUB_SHA
- if [ $? -neq 0 ]; then
- git status | sed -n 's/deleted by us://p' | xargs git add
- git cherry-pick --continue --no-edit
+
+ # github.event.commits is capped at 20 entries. Warn loudly if we hit
+ # the cap so a silently-truncated push shows up in the step summary
+ # rather than as "site branch is quietly missing commits."
+ if [ "$(echo "$COMMITS" | jq 'length')" -ge 20 ]; then
+ echo "::warning::Push contains 20+ commits — github.event.commits
may be truncated; some commits may not be cherry-picked."
fi
+
+ # Extract each commit SHA from the push payload and iterate
chronologically
+ echo "$COMMITS" | jq -r '.[].id' | while read -r commit_sha; do
+ echo "----------------------------------------"
+ echo "Cherry-picking commit: $commit_sha"
+ echo "----------------------------------------"
+
+ if ! git cherry-pick --strategy=recursive -X theirs "$commit_sha";
then
Review Comment:
The if condition is slightly different than before. Did you test the action
with cherry-pick conflicts to ensure it works?
##########
.github/workflows/publish-non-release-website-updates.yml:
##########
@@ -35,15 +35,33 @@ jobs:
with:
fetch-depth: 0
ref: site
- - name: Cherry pick the commit to site
+ - name: Cherry pick all commits in push to site
+ env:
+ COMMITS: ${{ toJson(github.event.commits) }}
run: |
git config user.email ${{ github.actor }}@users.noreply.github.com
git config user.name ${{ github.actor }}
- git cherry-pick --strategy=recursive -X theirs $GITHUB_SHA
- if [ $? -neq 0 ]; then
- git status | sed -n 's/deleted by us://p' | xargs git add
- git cherry-pick --continue --no-edit
+
+ # github.event.commits is capped at 20 entries. Warn loudly if we hit
+ # the cap so a silently-truncated push shows up in the step summary
+ # rather than as "site branch is quietly missing commits."
+ if [ "$(echo "$COMMITS" | jq 'length')" -ge 20 ]; then
+ echo "::warning::Push contains 20+ commits — github.event.commits
may be truncated; some commits may not be cherry-picked."
fi
Review Comment:
Do you have an example of how this looks?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]