Skip to content

Update API endpoint from deprecated api.coindix to new api.nanoly #5457

Update API endpoint from deprecated api.coindix to new api.nanoly

Update API endpoint from deprecated api.coindix to new api.nanoly #5457

name: Branch Name Check
on:
pull_request:
branches:
- develop
- main
types: [opened, synchronize, edited]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
check-branch-name:
runs-on: ubuntu-latest
outputs:
source-branch: ${{ steps.branch-name-check.outputs.source-branch }}
target-branch: ${{ steps.branch-name-check.outputs.target-branch }}
steps:
- name: Extract branch names
id: branch-name-check
run: |
source_branch=$(jq -r .pull_request.head.ref "$GITHUB_EVENT_PATH")
target_branch=$(jq -r .pull_request.base.ref "$GITHUB_EVENT_PATH")
echo "Source-branch=$source_branch" >> $GITHUB_OUTPUT
echo "target-branch=$target_branch" >> $GITHUB_OUTPUT
- name: Show Output result for source-branch and target-branch
run: |
echo "source-branch=${{ steps.branch-name-check.outputs.source-branch }}"
echo "target-branch=${{ steps.branch-name-check.outputs.target-branch }}"
- name: Check branch name for develop PRs
if: ${{ steps.branch-name-check.outputs.target-branch == 'develop' }}
run: |
if [[ "${{ steps.branch-name-check.outputs.source-branch }}" =~ ^(main|feature/.*|docs/.*|hotfix/.*|release/[0-9]+\.[0-9]+\.[0-9]+(rc[0-9]+)?)$ ]]; then
echo "Branch name is valid"
else
echo "Invalid branch name. Branches must follow the GitFlow naming convention to be allowed to merge into the develop branch."
exit 1
fi
- name: Check branch name for main PRs
if: ${{ steps.branch-name-check.outputs.target-branch == 'main' }}
run: |
if [[ "${{ steps.branch-name-check.outputs.source-branch }}" =~ ^(hotfix/.*|release/[0-9]+\.[0-9]+\.[0-9]+(rc[0-9]+)?)$ ]]; then
echo "PR is from a hotfix or release branch and targets the main branch"
else
echo "PR is not from a hotfix or release branch. Pull requests must be from a hotfix or release branch and target the main branch"
exit 1
fi