Skip to content

Add option to auto deploy to docs-latest #9

Add option to auto deploy to docs-latest

Add option to auto deploy to docs-latest #9

Workflow file for this run

name: Docs deploy pre-check
on:
pull_request:
types:
- opened
- synchronize
- reopened
- labeled
- unlabeled
permissions:
contents: "read"
id-token: "write"
defaults:
run:
shell: bash
concurrency:
group: pr-${{ github.event.pull_request.number }}-auto-docs-check
cancel-in-progress: true
jobs:
check-cherry-pick:
name: Check if merge commit can be cherry-picked
runs-on: ubuntu-latest
if: ${{ contains(github.event.pull_request.labels.*.name, 'deploy docs') }}
steps:
- uses: actions/checkout@v3
with:
# ref - not set, because we want to end up on the merge commit
fetch-depth: 0 # don't perform a shallow clone
- name: Try cherry-pick
env:
GH_TOKEN: ${{ secrets.RERUN_BOT_TOKEN }}
run: |
# Setup git user
git config --global user.name "rerun-bot"
git config --global user.email "[email protected]"
git checkout docs-latest
# Try the cherry-pick and capture the exit code
from=$(git rev-parse ${{ github.event.pull_request.base.sha }})
to=$(git rev-parse ${{ github.event.pull_request.head.sha }})
if git cherry-pick --no-commit $from..$to; then
echo "Cherry-pick successful"
exit 0
else
echo "Cherry-pick failed"
printf $(git diff)
exit 1
fi