Skip to content

Commit

Permalink
Try a different pattern for !stable-docs refs #1
Browse files Browse the repository at this point in the history
  • Loading branch information
simonw authored Aug 20, 2023
1 parent 4d33a39 commit 5692dd6
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions .github/workflows/stable-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v3

with:
fetch-depth: 0 # We need all commits to find docs/ changes
- name: Set up Git user
run: |
git config user.name "Automated"
Expand All @@ -40,11 +41,9 @@ jobs:
- name: Handle Commit to Main
if: contains(github.event.head_commit.message, '!stable-docs')
run: |
git fetch --all
git diff-tree --no-commit-id --name-only -r ${{ github.sha }} | grep '^docs/' > changes.txt
if [[ -s changes.txt ]]; then
git checkout stable-docs
git checkout ${{ github.sha }} -- $(cat changes.txt)
git commit -m "Cherry-picked docs changes from ${{ github.sha }}"
git push origin stable-docs
fi
# Apply all changes that affect docs/ directory
for commit in $(git log --format="%H" origin/main ^origin/stable-docs); do
git show $commit -- docs/ | git apply -
git add docs/
git commit -m "Cherry-picked docs changes from $commit" || true
done

0 comments on commit 5692dd6

Please sign in to comment.