Adds multiple auto-pruning policies info (#1119) #19
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Cherry Pick | |
on: | |
issue_comment: | |
types: [created] | |
jobs: | |
cherry-pick: | |
runs-on: ubuntu-latest | |
if: | | |
startsWith(github.event.comment.body, '/cherry-pick') | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v2 | |
- name: Set up Git | |
run: | | |
git config --global user.name "${{ github.actor }}" | |
git config --global user.email "${{ github.actor }}@users.noreply.github.com" | |
- name: Extract target branch | |
id: extract | |
run: echo "::set-output name=branch::$(echo "${{ github.event.comment.body }}" | cut -d' ' -f2)" | |
- name: Cherry-pick the PR | |
env: | |
GH_PAT: ${{ secrets.GH_PAT }} | |
run: | | |
TARGET_BRANCH=${{ steps.extract.outputs.branch }} | |
git fetch origin ${{ github.event.pull_request.head.ref }} | |
git checkout $TARGET_BRANCH | |
git cherry-pick ${{ github.event.pull_request.head.sha }} || exit 0 | |
- name: Push changes | |
env: | |
GH_PAT: ${{ secrets.GH_PAT }} | |
run: | | |
git push https://${GH_PAT}@github.com/${{ github.repository }} $TARGET_BRANCH |