Bump actions/checkout from 3 to 4 #5
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: Retarget Dependabot PR | |
on: | |
pull_request: | |
branches: | |
- dependabot-updates | |
types: | |
- opened | |
- synchronize | |
jobs: | |
retarget: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Get all branches | |
run: | | |
git fetch --all | |
git branch -r > branches.txt | |
cat branches.txt | |
- name: Find the lowest version branch | |
id: find_branch | |
run: | | |
lowest_branch=$(grep -o 'origin/v[0-9]*\.[0-9]*' branches.txt | sort -V | head -n 1 | sed 's/origin\///') | |
echo "lowest_branch=$lowest_branch" >> $GITHUB_ENV | |
- name: Retarget PR to lowest version branch | |
if: success() | |
run: | | |
gh pr edit ${{ github.event.pull_request.number }} --base ${{ env.lowest_branch }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |