Skip to content

Sync Gloo APIs. Destination Branch: gloo-main #1055

Sync Gloo APIs. Destination Branch: gloo-main

Sync Gloo APIs. Destination Branch: gloo-main #1055

name: Create PR for LTS Branch
on:
push:
branches:
- 'sync-apis/**/**'
jobs:
create-pr-for-api-sync-branches:
runs-on: ubuntu-22.04
steps:
- name: Cancel Previous Actions
uses: styfle/cancel-workflow-action@0.11.0
with:
access_token: ${{ github.token }}
- name: Checkout Branch
uses: actions/checkout@v3
- name: Parse GitHub Ref
id: parse_github_ref
env:
DELIMITER: "/"
DEST_BRANCH_FIELD_NUMBER: 2
TAG_NAME_FIELD_NUMBER: 3
REF: ${{ github.ref }}
IGNORE_REF_PREFIX: 'refs/heads/'
run: |
echo "REF: $REF"
GITHUB_BRANCH_NAME=${REF#"$IGNORE_REF_PREFIX"}
echo "GITHUB_BRANCH_NAME: $GITHUB_BRANCH_NAME"
DESTINATION_BRANCH=$(echo $GITHUB_BRANCH_NAME | cut -f $DEST_BRANCH_FIELD_NUMBER -d $DELIMITER )
TAG_NAME=$(echo $GITHUB_BRANCH_NAME | cut -f $TAG_NAME_FIELD_NUMBER -d $DELIMITER )
echo "destination_branch=$DESTINATION_BRANCH" >> $GITHUB_OUTPUT
echo "tag_name=$TAG_NAME" >> $GITHUB_OUTPUT
- name: Setup Git
env:
GIT_USER_NAME: soloio-bot
GIT_USER_EMAIL: soloio-bot@github.com
run: |
git config user.name $GIT_USER_NAME
git config user.email $GIT_USER_EMAIL
- name: Ensure LTS Branch Exists
env:
BRANCH: ${{ steps.parse_github_ref.outputs.destination_branch }}
run: |
git fetch origin
BRANCH_EXISTS=$(git ls-remote --heads origin $BRANCH)
if [[ -z ${BRANCH_EXISTS} ]]; then
echo "$BRANCH does not exist, creating it"
git push origin "HEAD:$BRANCH"
else
echo "$BRANCH exists, nothing to do"
fi
- name: Create Pull Request
uses: repo-sync/pull-request@v2.6.2
with:
destination_branch: ${{ steps.parse_github_ref.outputs.destination_branch }}
pr_reviewer: "solo-apis/solo-apis"
pr_label: "auto-pr"
pr_allow_empty: true
github_token: ${{ secrets.SOLO_BOT_REPO_SECRET }}
pr_title: "Sync APIs. @tag-name=${{ steps.parse_github_ref.outputs.tag_name }}"