Merge pull request #703 from Warwick-Plasma/keith/update_sdf #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: auto-pr | |
on: | |
push: | |
branches: | |
- 4.*-devel | |
jobs: | |
pull-request: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Set branch variables | |
run: BASE_REF=$(echo $GITHUB_REF | cut -f3- -d\/); | |
major=$(echo $BASE_REF | cut -f1 -d\.); | |
minor=$(echo $BASE_REF | cut -f2 -d\. | cut -f1 -d\-); | |
DEST_BRANCH=$major.$((minor+1))-devel; | |
git branch -a | grep "origin/$DEST_BRANCH" || { | |
DEST_BRANCH=$((major+1)).0-devel; | |
git branch -a | grep "origin/$DEST_BRANCH" || exit 1; | |
}; | |
echo "BASE_REF=$BASE_REF" >> $GITHUB_ENV; | |
echo "DEST_BRANCH=$DEST_BRANCH" >> $GITHUB_ENV; | |
- name: Create Pull Request | |
id: open-pr | |
uses: repo-sync/pull-request@v2 | |
with: | |
destination_branch: ${{ env.DEST_BRANCH }} | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
pr_title: "Pull $BASE_REF into $DEST_BRANCH" | |
pr_label: "auto-pr" | |
- name: Auto approve | |
uses: hmarr/auto-approve-action@v2 | |
with: | |
github-token: ${{ secrets.GH_APPROVE }} | |
pull-request-number: ${{ steps.open-pr.outputs.pr_number }} |