github / gh-classroom

GitHub Classroom CLI Extension is a powerful and easy-to-use command line tool that enhances the functionality of the GitHub CLI, specifically tailored for educators using GitHub Classroom.
MIT License
75 stars 12 forks source link

Filter directory contents before applying pull to repos #59

Closed physcrowley closed 8 months ago

physcrowley commented 8 months ago

What are you trying to accomplish?

I added a filter for the pull command that only looks for local directories in the "x-submissions" folder before running the pulls on each student repo.

This allows companion files to be added to the "x-submissions" folder, such as comment files or tests, that the teacher may use on the student-repos.

fixes #58

What approach did you choose and why?

I traversed the originally extracted entries and simply applied isDir() to add only directories to the list of entries that continue on in the tool's existing code.

I added this change because it offers flexibility to the teacher. It also makes sure that the pull command is only attempting its operations on entries that are directories.

What should reviewers focus on?

I have run tests on "dirty" parent directories that otherwise fail with the current tool. They work as expected: ignoring files and pulling the repos. It would be important to run further tests on the code validity.

I have limited knowledge and experience with the Go language, so it would be important for someone with experience to make sure that I haven't introduced unintended side effects.

physcrowley commented 8 months ago

My implementation traverses all the items in the repo and creates a new list to pass on to the existing code, but it may be more efficient to filter the list while it's being created initially. I have small classes (high school), so I don't see any lag, but a larger classroom (university, MOOC) might.

physcrowley commented 8 months ago

Can this PR be closed now? I'm a first timer outside of student code, so I apologise if this is an obvious question.

zrdaley commented 8 months ago

@physcrowley yes, once approved PRs can be merged đŸ˜„ then we create a new release and users can upgrade their CLI version

zrdaley commented 8 months ago

Once this action is green, you will be able to upgrade the CLI with your changes included!