|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +# List of branch names to process |
| 4 | +BRANCHES=( |
| 5 | + "sample-code/start-here" |
| 6 | + "sample-code/module-3-my-first-playwright-test" |
| 7 | + "sample-code/module-4-interacting-with-elements" |
| 8 | + "sample-code/module-5-refactoring" |
| 9 | + "sample-code/module-6-browser-options" |
| 10 | + "sample-code/module-7-browser-contexts" |
| 11 | + "sample-code/module-8-locators" |
| 12 | + "sample-code/module-9-forms" |
| 13 | + "sample-code/module-10-assertions" |
| 14 | + "sample-code/module-11-waits" |
| 15 | + "sample-code/module-12-api-interactions" |
| 16 | + "sample-code/module-12-mocking-api-calls" |
| 17 | + "sample-code/module-13-page-objects" |
| 18 | + "sample-code/module-14-allure-reporting" |
| 19 | + "sample-code/module-14-organizing-your-tests" |
| 20 | + "sample-code/module-14-parallel-execution" |
| 21 | + "sample-code/module-15-parallel-execution" |
| 22 | + "sample-code/module-16-allure-reporting" |
| 23 | + "sample-code/module-17-cucumber" |
| 24 | +) |
| 25 | + |
| 26 | +# Iterate over each branch |
| 27 | +for BRANCH_NAME in "${BRANCHES[@]}"; do |
| 28 | + echo "Processing branch $BRANCH_NAME..." |
| 29 | + |
| 30 | + # Check if the branch already exists locally |
| 31 | + if git branch --list | grep -q "$BRANCH_NAME"; then |
| 32 | + echo "Branch $BRANCH_NAME already exists locally. Checking it out..." |
| 33 | + git checkout "$BRANCH_NAME" |
| 34 | + else |
| 35 | + echo "Creating and checking out branch $BRANCH_NAME..." |
| 36 | + git checkout -b "$BRANCH_NAME" |
| 37 | + fi |
| 38 | + |
| 39 | + # Add and commit changes (if any) |
| 40 | + git add . |
| 41 | + git commit -m "Add or update code for $BRANCH_NAME" || echo "No changes to commit for $BRANCH_NAME" |
| 42 | + |
| 43 | + # Push the branch to the origin remote |
| 44 | + echo "Pushing branch $BRANCH_NAME to GitHub..." |
| 45 | + git push -u origin "$BRANCH_NAME" |
| 46 | + |
| 47 | + echo "Branch $BRANCH_NAME processed successfully." |
| 48 | +done |
| 49 | + |
| 50 | +echo "All branches have been processed!" |
0 commit comments