Sync Gloo APIs. Destination Branch: gloo-v1.16.x #1094
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: 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/[email protected] | |
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: [email protected] | |
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/[email protected] | |
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 }}" |