Skip to content
Open
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
23 changes: 17 additions & 6 deletions .github/workflows/publish-non-release-website-updates.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,26 @@ 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
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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The if condition is slightly different than before. Did you test the action with cherry-pick conflicts to ensure it works?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My understanding is that in the old code, the "if" block was actually never reachable, because github runs the command transparently with -e , so if the cherry-pick failed, the action was aborted and the "if" was never reached.
IIANM, inserting the command directly on the "if" condition will achieve the intended purpose.

echo "Handling cherry-pick conflict..."
git status | sed -n 's/deleted by us://p' | xargs -r git add
git cherry-pick --continue --no-edit
fi
done

git push origin site

publish-website:
Expand Down
Loading