Skip to content

Implement T9L1/create-pr-from-main#276

Merged
desmondwong1215 merged 8 commits into
git-mastery:mainfrom
desmondwong1215:exercise/create-pr-from-main
Apr 21, 2026
Merged

Implement T9L1/create-pr-from-main#276
desmondwong1215 merged 8 commits into
git-mastery:mainfrom
desmondwong1215:exercise/create-pr-from-main

Conversation

@desmondwong1215
Copy link
Copy Markdown
Contributor

@desmondwong1215 desmondwong1215 commented Mar 23, 2026

Exercise Review

Exercise Discussion

Fixes #274

Checklist

  • If you require a new remote repository on the Git-Mastery organization, have you created a request for it?
  • Have you written unit tests using repo-smith to validate the exercise grading scheme?
  • Have you tested your changes using the instructions posted?
  • Have you verified that this exercise does not already exist or is not currently in review?
  • Did you introduce a new grading mechanism that should belong to git-autograder?
  • Did you introduce a new dependency that should belong to app?

@github-actions
Copy link
Copy Markdown

Hi @desmondwong1215, thank you for your contribution! 🎉

This PR comes from your fork desmondwong1215/exercises on branch exercise/create-pr-from-main.

Before you request for a review, please ensure that you have tested your changes locally!

Important

The previously recommended way of using ./test-download.py is no longer the best way to test your changes locally.

Please read the following instructions for the latest instructions.

Prerequisites

Ensure that you have the gitmastery app installed locally (instructions)

Testing steps

If you already have a local Git-Mastery root to test, you can skip the following step.

Create a Git-Mastery root locally:

gitmastery setup

Navigate into the Git-Mastery root (defaults to gitmastery-exercises/):

cd gitmastery-exercises/

Edit the .gitmastery.json configuration file. You need to set the following values under the exercises_source key.

{
    # other fields...
    "exercises_source": {
        "username": "desmondwong1215",
        "repository": "exercises",
        "branch": "exercise/create-pr-from-main"
    }
}

Then, you can use the gitmastery app to download and verify your changes locally.

gitmastery download <your new change>
gitmastery verify

Checklist

  • (For exercises and hands-ons) I have verified that the downloading behavior works
  • (For exercises only) I have verified that the verification behavior is accurate

Important

To any reviewers of this pull request, please use the same instructions above to test the changes.

@desmondwong1215 desmondwong1215 force-pushed the exercise/create-pr-from-main branch from 4fdf214 to 054153b Compare April 6, 2026 16:03
@desmondwong1215 desmondwong1215 force-pushed the exercise/create-pr-from-main branch from 64464d1 to 3f342a4 Compare April 15, 2026 00:38
@jovnc jovnc requested a review from Copilot April 15, 2026 06:07
@jovnc jovnc marked this pull request as ready for review April 15, 2026 06:07
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new Git-Mastery exercise (create-pr-from-main) intended to grade students on creating a PR from their fork’s main branch to the upstream repo and then pushing a follow-up commit that fixes Java.txt.

Changes:

  • Introduces a new exercise verifier (verify.py) that fetches the student’s PR and validates branch + file contents.
  • Adds unit tests (test_verify.py) to cover success and failure paths.
  • Adds exercise scaffolding: download hook, README link, and .gitmastery-exercise.json config for a remote repo-backed exercise.

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
create_pr_from_main/verify.py Implements PR discovery/fetch and Java.txt content validation.
create_pr_from_main/test_verify.py Adds unit tests for the new verifier logic.
create_pr_from_main/download.py Sets start tag and configures PR repo full name for the exercise.
create_pr_from_main/README.md Links to the hosted exercise instructions.
create_pr_from_main/.gitmastery-exercise.json Declares exercise metadata and remote repo configuration.
create_pr_from_main/init.py Package marker for the exercise module.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread create_pr_from_main/test_verify.py Outdated
Comment thread create_pr_from_main/README.md Outdated
Comment thread create_pr_from_main/verify.py
Comment thread create_pr_from_main/verify.py
Comment thread create_pr_from_main/verify.py
Comment thread create_pr_from_main/verify.py Outdated
Comment thread create_pr_from_main/test_verify.py Outdated
@jovnc
Copy link
Copy Markdown
Collaborator

jovnc commented Apr 20, 2026

@desmondwong1215 I presume this won't work until we update the app to the latest version? For now, I'll try to test by compiling the latest binary and using that instead of the official release one.

@jovnc
Copy link
Copy Markdown
Collaborator

jovnc commented Apr 20, 2026

@desmondwong1215 Encountering this error at the end of step 2, do you know what's the issue?

I'm currently using the latest build of the app with the correct repo-smith and git-autograder versions.

image

@desmondwong1215
Copy link
Copy Markdown
Contributor Author

It seems like the exercise_config is not updated correctly in the first run in the REPL. It does not have an error when I run it the second time in the REPL or run gitmastery verify (without using REPL). I have added a fix to git-autograder to update the exercise.config at git-mastery/git-autograder#37, which should fix the issue.

@jovnc
Copy link
Copy Markdown
Collaborator

jovnc commented Apr 21, 2026

@desmondwong1215 Thanks the fix worked!

However, I'm still getting some errors in verification after updating to 1995 and pushing the changes to the PR.

image image

Do you know the issue? Is this a cache issue by gh cli?

Comment thread create_pr_from_main/verify.py Outdated
WRONG_HEAD_BRANCH = "The PR's head branch is not 'main'."


EXPECTED_CONTENT_STEP_3 = ["1955, by James Gosling"]
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, it should be 1995 instead

Image

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for catching this. I have fixed it already.

@desmondwong1215 desmondwong1215 force-pushed the exercise/create-pr-from-main branch from 805225d to 980bf18 Compare April 21, 2026 16:09
Copy link
Copy Markdown
Collaborator

@jovnc jovnc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, feel free to merge if ready

@desmondwong1215 desmondwong1215 merged commit 69e4851 into git-mastery:main Apr 21, 2026
4 checks passed
@desmondwong1215 desmondwong1215 deleted the exercise/create-pr-from-main branch April 21, 2026 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Exercise: create-pr-from-main] T9L1. Creating a PR from the main branch

3 participants