Fix the backport action by fetching branches before backporting #2
Workflow file for this run
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: Backport PRs | ||
on: | ||
pull_request: | ||
types: | ||
- closed | ||
jobs: | ||
backport-v0_34_x: | ||
runs-on: ubuntu-latest | ||
if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'backport-v0.34.x') | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v2 | ||
- name: Fetch all branches | ||
run: git fetch origin v0.34.x:v0.34.x | ||
- name: Install Hub CLI | ||
run: sudo snap install --classic hub | ||
- name: Backport to v0.34.x | ||
run: | | ||
git checkout v0.34.x | ||
git cherry-pick ${{ github.event.pull_request.merge_commit_sha }} | ||
git push | ||
hub pull-request -m "Backport: ${{ github.event.pull_request.title }}" | ||
backport-v0_37_x: | ||
runs-on: ubuntu-latest | ||
if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'backport-v0.37.x') | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v2 | ||
- name: Fetch all branches | ||
run: git fetch origin v0.37.x:v0.37.x | ||
- name: Install Hub CLI | ||
run: sudo snap install --classic hub | ||
- name: Backport to v0.37.x | ||
run: | | ||
git checkout v0.37.x | ||
git cherry-pick ${{ github.event.pull_request.merge_commit_sha }} | ||
git push | ||
hub pull-request -m "Backport: ${{ github.event.pull_request.title }}" |