How to enforce branch protection in GitHub Classroom (Protected file paths?) #181495
Replies: 2 comments
-
|
Hi Joaquín, You are absolutely correct in your suspicion: "Protected file paths" in GitHub Classroom will not achieve what you are looking for. Here is the breakdown of why, and the solution to enforce the GitHub Flow (Pull Requests) workflow for your students.
However, GitHub recently introduced Repository Rulesets, which is the perfect solution for this. You can define a rule at the Organization level that applies to all current and future student repositories automatically. How to set it up:
Optional: Set "Required number of approvals" to 0 if you want them to be able to merge their own PRs (simulating the flow), or 1 if you want them to review each other/you to review. Why this works for Classroom Hope this helps! |
Beta Was this translation helpful? Give feedback.
-
|
Why don't you add new branch to repo so that way you can protect your original code |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi everyone,
I want my students to follow the GitHub Flow workflow, so I would like to protect the
mainbranch to prevent direct commits and require them to work through branches and Pull Requests before merging intomain.I’m not sure whether the new Protected file paths feature in GitHub Classroom assignments can enforce this behavior. The documentation states:
However, this sounds more like a monitoring mechanism rather than branch protection.
If possible, I would really appreciate some guidance on how to properly set up branch protection rules in the context of GitHub Classroom assignments, or whether this can be configured directly within a template repository.
Thanks in advance for your support.
Joaquín
Beta Was this translation helpful? Give feedback.
All reactions