Chore: Update CLI docs (#770) #1929
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: Merge main into PR and test build | |
on: | |
pull_request: | |
types: [opened, reopened, synchronize] | |
push: | |
branches: | |
- main | |
jobs: | |
merge_and_build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get PR branch name | |
id: pr_branch | |
run: echo "::set-output name=branch::${{ github.event.pull_request.head.ref }}" | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Node.js and Yarn | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '20' | |
- name: Install Yarn | |
run: npm install -g yarn | |
- name: Merge and check build | |
run: | | |
git config user.email "[email protected]" | |
git config user.name "hasura-bot" | |
# Get the PR branch's name from the event payload | |
BRANCH_NAME=${{ steps.pr_branch.outputs.branch }} | |
echo "π€ Attempting to merge 'main' into '$BRANCH_NAME'..." | |
# Check out and pull the 'main' branch | |
git fetch > /dev/null 2>&1 | |
git checkout main > /dev/null 2>&1 | |
git pull > /dev/null 2>&1 | |
echo "β¬οΈ Checked out and pulled 'main' branch." | |
# Check out and pull the PR's branch | |
git checkout $BRANCH_NAME > /dev/null 2>&1 | |
git pull > /dev/null 2>&1 | |
echo "β¬οΈ Checked out and pulled $BRANCH_NAME branch." | |
# Merge 'main' into the PR's branch | |
git merge --no-edit main > /dev/null 2>&1 | |
echo "π Merged 'main' into '$BRANCH_NAME'." | |
# Check if there are merge conflicts | |
if [ $? -eq 0 ]; then | |
# No merge conflicts, so we can proceed with the build | |
echo "π§ Installing dependencies..." | |
yarn install > /dev/null 2>&1 | |
echo "π§° Building..." | |
yarn build > /dev/null 2>&1 | |
# Check if the build was successful | |
if [ $? -eq 0 ]; then | |
# Build succeeded | |
echo "π Merge and build succeeded, okay to merge PR π." | |
else | |
echo "β Build failed. Please fix any issues before committing." | |
exit 1 | |
fi | |
else | |
echo "π₯ Merge conflicts encountered. Resolve conflicts before committing." | |
exit 1 | |
fi |