Skip to content

Commit 5fca75c

Browse files
committed
Update README.md
more edits
1 parent 04e8b0b commit 5fca75c

1 file changed

Lines changed: 62 additions & 107 deletions

File tree

README.md

Lines changed: 62 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ This means each pair will have **two repositories** - one per person.
8585

8686
## Exercise Instructions
8787

88+
> **Note:** A checklist is provided at the end of this document to help you track your progress and ensure you complete all exercise steps.
89+
8890
### Step 1: Set Up Your Repository
8991

9092
**Each partner** creates their own repository from this template:
@@ -297,102 +299,62 @@ After receiving review feedback on **your own repository**:
297299

298300
After your feature is merged, create a Python script to extract PR information from your repository.
299301

300-
**Your Task:** Research the GitHub REST API and write a script called `mine_prs.py` that supports two modes:
301-
302-
**Mode 1: List All PRs**
302+
**Your Task:** Research ways to mine a GitHub repo and write a script called `mine_prs.py` that:
303303

304304
- Accepts repository owner and name as command-line arguments
305305
- Fetches all Pull Requests from the repository
306-
- Displays summary information for each PR
307-
308-
**Mode 2: Get Commits for a Specific PR**
309-
310-
- Accepts repository owner, name, and PR number as command-line arguments
311-
- Retrieves and displays all commits associated with that specific PR
306+
- For each PR, retrieves and displays all associated commits
312307

313308
**Requirements:**
314309

315310
- [ ] Accepts repository owner and name as command-line arguments
316-
- [ ] Optionally accepts a PR number to get commits for a specific PR
317-
- [ ] When no PR number is provided: lists all PRs with summary info
318-
- [ ] When PR number is provided: retrieves commits for that specific PR
311+
- [ ] Fetches all PRs from the repository
312+
- [ ] For each PR, retrieves its associated commits
319313
- [ ] Displays information in a clear, formatted output
320314

321315
**Information to Display:**
322316

323-
For listing all PRs:
317+
For each PR:
324318

325319
- PR number and title
326320
- PR state (open/closed/merged)
327321
- PR author
328322
- Creation date
329-
330-
For a specific PR's commits:
331-
332-
- PR number and title
333-
- Each commit's SHA (short format)
334-
- Commit message
335-
- Commit author
336-
- Commit date
323+
- List of commits with:
324+
- Commit SHA (short format)
325+
- Commit message
326+
- Commit author
337327

338328
**Suggested Output Format:**
339329

340330
```
341-
# Mode 1: List all PRs
342-
$ python mine_prs.py owner repo
331+
$ python mine_prs.py your-username collabdev-exercise-username
343332
344333
============================================================
345-
PULL REQUESTS FOR owner/repo
334+
PULL REQUESTS FOR your-username/collabdev-exercise-username
346335
============================================================
347336
348-
PR #2: Add product categories
349-
State: merged
350-
Author: partner-username
351-
Created: 2024-01-15T10:30:00Z
352-
353337
PR #1: Add low-stock alert functionality
354338
State: merged
355339
Author: your-username
356340
Created: 2024-01-15T09:00:00Z
341+
Commits:
342+
- abc1234: Add is_low_stock method to Product class (Your Name)
343+
- def5678: Add get_low_stock_products function (Your Name)
344+
- ghi9012: Add unit tests for low stock functionality (Your Name)
357345
358346
------------------------------------------------------------
359-
Total PRs: 2
360-
============================================================
361-
```
362-
363-
```
364-
# Mode 2: Get commits for specific PR
365-
$ python mine_prs.py owner repo 1
366-
367-
============================================================
368-
COMMITS FOR PR #1: Add low-stock alert functionality
369-
============================================================
370-
371-
abc1234 - Add is_low_stock method to Product class
372-
Author: Your Name
373-
Date: 2024-01-15T09:15:00Z
374-
375-
def5678 - Add get_low_stock_products function
376-
Author: Your Name
377-
Date: 2024-01-15T09:30:00Z
378-
379-
ghi9012 - Add unit tests for low stock functionality
380-
Author: Your Name
381-
Date: 2024-01-15T09:45:00Z
382-
383-
------------------------------------------------------------
384-
Total commits: 3
347+
Total PRs: 1
385348
============================================================
386349
```
387350

388351
**Hints:**
389352

390-
- Use a GitHub library like `PyGithub` to interact with the GitHub API
353+
- You can use a GitHub library like `PyGithub` or '`PyDriller` to interact with the GitHub API
391354
- Use `sys.argv` or `argparse` to handle command-line arguments
392355
- Use `python-dotenv` to load environment variables from a `.env` file
393356
- GitHub API endpoint for PRs: `https://api.github.com/repos/{owner}/{repo}/pulls`
394357
- GitHub API endpoint for PR commits: `https://api.github.com/repos/{owner}/{repo}/pulls/{pr_number}/commits`
395-
- Use `state=all` parameter to get both open and closed PRs
396358

397359
**GitHub Token Setup:**
398360

@@ -410,64 +372,18 @@ Total commits: 3
410372

411373
7. **Important:** Add `.env` to your `.gitignore` to keep your token secure!
412374

413-
8. **Add dependencies to `requirements.txt`:**
414-
```
415-
pytest==8.0.0
416-
PyGithub
417-
python-dotenv
418-
```
375+
8. \*\*Add dependencies to `requirements.txt`
419376

420377
**Run your script:**
421378

422379
```bash
423380
pip install -r requirements.txt
424381

425-
# List all PRs
426382
python mine_prs.py <owner> <repo>
427-
428-
# Get commits for a specific PR
429-
python mine_prs.py <owner> <repo> <pr_number>
430383
```
431384

432385
---
433386

434-
## Exercise Checklist
435-
436-
### Your Repository
437-
438-
- [ ] Created your own repository from template (using "Use this template" button)
439-
- [ ] Added your partner as a collaborator
440-
- [ ] Created an Issue for your assigned feature
441-
- [ ] Created a feature branch
442-
- [ ] Implemented the feature with tests
443-
- [ ] Created a Pull Request linked to the Issue
444-
- [ ] Added your partner as a reviewer on your PR
445-
- [ ] Addressed review feedback (if any)
446-
- [ ] CI passes on your PR
447-
- [ ] PR merged to main
448-
449-
### Partner's Repository
450-
451-
- [ ] Accepted collaborator invitation
452-
- [ ] Reviewed your partner's Pull Request
453-
- [ ] Left constructive comments on the code
454-
- [ ] Submitted review (approved or requested changes)
455-
456-
### PR Mining Script
457-
458-
- [ ] Created a GitHub Personal Access Token
459-
- [ ] Set up `.env` file with token (and added `.env` to `.gitignore`)
460-
- [ ] Added dependencies (PyGithub, python-dotenv) to `requirements.txt`
461-
- [ ] Researched GitHub REST API or PyGithub documentation
462-
- [ ] Created `mine_prs.py` script
463-
- [ ] Script supports Mode 1: List all PRs with summary info
464-
- [ ] Script supports Mode 2: Get commits for a specific PR number
465-
- [ ] Script accepts command-line arguments (owner, repo, optional PR number)
466-
- [ ] Output is clearly formatted and readable
467-
- [ ] Successfully executed script on your repository
468-
469-
---
470-
471387
## Submission Instructions
472388

473389
Submit the following evidence of your work to **Brightspace**:
@@ -506,9 +422,8 @@ Submit the following evidence of your work to **Brightspace**:
506422
6. **PR Mining Script Code and Output**
507423

508424
- Submit your `mine_prs.py` file
509-
- Include screenshots showing both modes of the script:
510-
- Mode 1 output: List of all PRs in your repository
511-
- Mode 2 output: Commits for your specific PR
425+
- Include a screenshot showing the script output:
426+
- List of all PRs in your repository with their associated commits
512427

513428
7. **Updated `requirements.txt` file**
514429

@@ -551,6 +466,46 @@ By completing this exercise, you will have practiced:
551466
- [GitHub REST API - List commits on a PR](https://docs.github.com/en/rest/pulls/pulls#list-commits-on-a-pull-request)
552467
- [PyGithub Documentation](https://pygithub.readthedocs.io/)
553468
- [PyGithub GitHub Repository](https://github.com/PyGithub/PyGithub)
469+
- [PyDriller Documentation](https://pydriller.readthedocs.io/)
470+
- [PyDriller GitHub Repository](https://github.com/ishepard/pydriller)
471+
472+
---
473+
474+
## Exercise Checklist
475+
476+
Use this checklist to track your progress and ensure you complete all exercise steps.
477+
478+
### Your Repository
479+
480+
- [ ] Created your own repository from template (using "Use this template" button)
481+
- [ ] Added your partner as a collaborator
482+
- [ ] Created an Issue for your assigned feature
483+
- [ ] Created a feature branch
484+
- [ ] Implemented the feature with tests
485+
- [ ] Created a Pull Request linked to the Issue
486+
- [ ] Added your partner as a reviewer on your PR
487+
- [ ] Addressed review feedback (if any)
488+
- [ ] CI passes on your PR
489+
- [ ] PR merged to main
490+
491+
### Partner's Repository
492+
493+
- [ ] Accepted collaborator invitation
494+
- [ ] Reviewed your partner's Pull Request
495+
- [ ] Left constructive comments on the code
496+
- [ ] Submitted review (approved or requested changes)
497+
498+
### PR Mining Script
499+
500+
- [ ] Created a GitHub Personal Access Token
501+
- [ ] Set up `.env` file with token (and added `.env` to `.gitignore`)
502+
- [ ] Added dependencies to `requirements.txt`
503+
- [ ] Researched GitHub REST API, PyGithub, or PyDriller documentation
504+
- [ ] Created `mine_prs.py` script
505+
- [ ] Script lists all PRs with their associated commits
506+
- [ ] Script accepts command-line arguments (owner, repo)
507+
- [ ] Output is clearly formatted and readable
508+
- [ ] Successfully executed script on your repository
554509

555510
---
556511

0 commit comments

Comments
 (0)