|
| 1 | +# Step 2: Prepare to collaborate |
| 2 | + |
| 3 | +Your simple school website has become quite popular! After showing it at the last staff meeting, Ms. Rodriguez from the Art Club and Mr. Chen from the Chess Club came up to you super excited. They have tons of ideas for new features! |
| 4 | + |
| 5 | +- Ms. Rodriguez wants to add a photo gallery |
| 6 | +- Mr. Chen dreams of adding a tournament bracket system for the chess/sports activities! 🎨♟️ |
| 7 | + |
| 8 | +While you're thrilled about their enthusiasm, you realize you need to set up some guidelines before letting them start changing code. The last thing you want is conflicting changes breaking the registration system right before spring break! |
| 9 | + |
| 10 | +Opening your project to other teachers at Mergington High means thinking about how everyone will work together without breaking each other's code. To help with collaboration, GitHub provides two special files: |
| 11 | + |
| 12 | +1. `CONTRIBUTING.md` - A "How to Help" guide. Some example content: |
| 13 | + |
| 14 | + - How to prepare a developer setup of the extra-curricular activities website. |
| 15 | + - The process for suggesting changes. |
| 16 | + - The project's coding style preference, to keep things consistent. |
| 17 | + - How to ask for help when stuck. |
| 18 | + |
| 19 | +2. `CODEOWNERS` - Assign specific people or teams responsible for a portion of the project. |
| 20 | + |
| 21 | + - When someone creates a pull request, GitHub will automatically ask the right person to review it. |
| 22 | + |
| 23 | +3. **Collaborators** - Give other people access to the project. |
| 24 | + |
| 25 | + - Provide other people permissions to change project files while still protecting repository settings. |
| 26 | + - Personal repositories have simple permissions. Organization repositories allow flexible permissions such as read, write, maintain, and admin. |
| 27 | + |
| 28 | +## ⌨️ Activity: Create a welcoming contribution guide |
| 29 | + |
| 30 | +The IT Club meeting is tomorrow, and you need to prepare for Ms. Rodriguez and Mr. Chen to join the project. Let's start a document to help them contribute effectively. |
| 31 | + |
| 32 | +1. Ensure you you are on the `prepare-to-collaborate` branch at the root directory. |
| 33 | + |
| 34 | +1. In the top directory, create a new file called `CONTRIBUTING.md`. |
| 35 | + |
| 36 | +1. Add a welcoming message. |
| 37 | + |
| 38 | + ```md |
| 39 | + # Contributing to the Mergington High Extra-Curricular Activities Website |
| 40 | + |
| 41 | + Thank you for your interest in helping improve our school's website! Whether you want to add your club's activities, fix a bug, or suggest new features, this guide will help you get started. 🎉 |
| 42 | + ``` |
| 43 | + |
| 44 | +1. Add instructions to help them quickly start developing. |
| 45 | + |
| 46 | + ```md |
| 47 | + ## Development Setup |
| 48 | + |
| 49 | + 1. Clone the repository to your computer. |
| 50 | + 2. Install Python requirements: `pip install -r requirements.txt`. |
| 51 | + 3. Run the development server: `python src/app.py`. |
| 52 | + 4. Visit http://localhost:8000 in your browser to see the website. |
| 53 | + |
| 54 | + ## Making Changes |
| 55 | + |
| 56 | + 1. Create a new branch for your changes. |
| 57 | + - Use descriptive names like `art-gallery-feature` or `fix-chess-signup` |
| 58 | + 2. Make your changes and test them locally with sample student data. |
| 59 | + - Use the MongoDB extension to preview the included sample date. |
| 60 | + 3. Push your branch and create a pull request. |
| 61 | + 4. Wait for review and address any feedback. |
| 62 | + |
| 63 | + ## Code Style |
| 64 | + |
| 65 | + - Follow PEP 8 for Python code (backend). |
| 66 | + - Use clear, descriptive variable names (student_name, start_time, etc.) |
| 67 | + - Add comments to describe blocks of logic. |
| 68 | + ``` |
| 69 | + |
| 70 | +1. Add a section for getting help. |
| 71 | + |
| 72 | + ```md |
| 73 | + ## Need help or have ideas? |
| 74 | + |
| 75 | + - Check the open issues first. |
| 76 | + - If your problem is there, add a comment or up-vote. |
| 77 | + - If not there, create a new issue. Be as descriptive as possible. |
| 78 | + - Ask in our weekly IT Club office hours (Thursdays at lunch in Room 203). |
| 79 | + - For other general problems, email the tech team at techclub@mergingtonhigh.example.edu |
| 80 | + ``` |
| 81 | + |
| 82 | +1. In the top right, use the **Commit changes...** button to save your changes. |
| 83 | + |
| 84 | +## ⌨️ Activity: Assign code ownership |
| 85 | + |
| 86 | +With others joining the fun, you want to stay involved on anything affecting architecture and core functionality. Let's assign you to the related files. |
| 87 | + |
| 88 | +1. Ensure you you are on the `prepare-to-collaborate` branch at the root directory. |
| 89 | + |
| 90 | +1. Above the list of files, click the **Add file** dropdown and select **Create new file**. |
| 91 | + |
| 92 | + <img width="300" alt="New file button" src="https://github.com/user-attachments/assets/8f3f8da8-1471-485a-9df5-8c03ecba2d8e"/> |
| 93 | + |
| 94 | +1. Set the file name as `CODEOWNERS`, without an file extension. |
| 95 | + |
| 96 | +1. Add the following content: |
| 97 | + |
| 98 | + ```codeowners |
| 99 | + # Core functionality - changes here should be rare! |
| 100 | + /src/app.py @{{ login }} |
| 101 | + /src/backend/database.py @{{ login }} |
| 102 | + /src/backend/routers/auth.py @{{ login }} |
| 103 | +
|
| 104 | + # The frontend will need refactored soon to be more object oriented. |
| 105 | + /src/static/ @{{ login }} |
| 106 | + ``` |
| 107 | + |
| 108 | +1. In the top right, use the **Commit changes...** button to save your changes. |
| 109 | + |
| 110 | +1. With the files committed, wait a moment for Mona to check your work, provide feedback, and share the next lesson. |
| 111 | + |
| 112 | +## ⌨️ Activity: (Optional) Add your first collaborator |
| 113 | + |
| 114 | +Ready to let your colleague start working on that photo gallery feature? Let's do it! |
| 115 | + |
| 116 | +> [!IMPORTANT] |
| 117 | +> This step is optional because it requires another person with a GitHub account to participate. |
| 118 | +
|
| 119 | +1. In the top navigation, select the **Settings** tab. |
| 120 | + |
| 121 | +1. In the left navigation, select **Collaborators**. |
| 122 | + |
| 123 | +1. Find the **Manage access** area and click the **Add people** button. |
| 124 | + |
| 125 | + <img width="350" alt="" src="https://github.com/user-attachments/assets/b1675ad5-57b1-441e-ab7a-22d26dccf6ce" /> |
| 126 | + |
| 127 | +1. Enter a friend/colleague's GitHub username or email then press the **Add to repository** button. |
| 128 | + |
| 129 | + <img width="350" alt="" src="https://github.com/user-attachments/assets/caf1a193-c9db-4962-b01e-66666ef54369" /> |
| 130 | + |
| 131 | + > [!IMPORTANT] |
| 132 | + > Personal repositories only have one collaboration role type. A "collaborator" receives **write** permissions but NOT **admin** permissions. |
0 commit comments