Skip to content

Commit

Permalink
Update build-push-next.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
danchitnis authored Nov 20, 2024
1 parent 943de83 commit f0bc61e
Showing 1 changed file with 32 additions and 12 deletions.
44 changes: 32 additions & 12 deletions .github/workflows/build-push-next.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,20 @@ jobs:
repository: eelab-dev/EEcircuit
ref: next # Checkout the "next" branch

# Delete bot branch if it exists
- name: Delete 'bot' branch if it exists
run: |
if git show-ref --verify --quiet refs/heads/bot; then
git branch -D bot
fi
# Create new 'bot' branch from 'next'
- name: Create new 'bot' branch
run: |
git checkout next
git checkout -b bot

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

Expand Down Expand Up @@ -65,22 +79,28 @@ jobs:
name: playwright-report
path: playwright-report/
retention-days: 30

# Check if 'bot' branch exists and delete it if it does
- name: Delete 'bot' branch if it exists
run: git branch -a | grep -q bot && git branch -D bot || echo "Branch 'bot' not found"

# Create new 'bot' branch from 'next'
- name: Create new 'bot' branch


# First handle any uncommitted changes
- name: Stage and commit any changes
run: |
git checkout next
git checkout -b bot
git add .
git diff --staged --quiet || git commit -m "Automated: Stage uncommitted changes"

# Create a Pull Request
# Create Pull Request only if there are differences
- name: Create Pull Request
run: gh pr create --base next --head bot --title "Update from bot branch" --body "Automated pull request to merge changes from the bot branch to next."
run: |
if [ $(git rev-list --count next..bot) -gt 0 ]; then
gh pr create \
--base next \
--head bot \
--title "Update from bot branch" \
--body "Automated pull request to merge changes from the bot branch to next."
else
echo "No changes to create PR for"
fi


0 comments on commit f0bc61e

Please sign in to comment.