From 2c1536ab96a19dfc719108dc4b641acc8a495375 Mon Sep 17 00:00:00 2001 From: caitwolf Date: Thu, 24 Jan 2019 13:42:47 -0800 Subject: [PATCH 1/9] updated README.md --- README.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 5f7f3cc..7103f36 100644 --- a/README.md +++ b/README.md @@ -11,9 +11,9 @@ This script will batch submit the homeowrk grading issues for all github repos ( ### Installation of Required Tools -The shell script relies on the ``` github/hub ``` tool to create issues by command line. Follow the [installation instructions] (https://github.com/github/hub) found at their github page to install the tool on your device. +The shell script relies on the ``` github/hub ``` tool to create issues by command line. Follow the [installation instructions](https://github.com/github/hub) found at their github page to install the tool on your device. -User documentation for the Hub tool can be found [here] (https://hub.github.com/hub.1.html). It extends many git commands and also provides new commands of its own. +User documentation for the Hub tool can be found [here](https://hub.github.com/hub.1.html). It extends many git commands and also provides new commands of its own. ### Usage @@ -22,5 +22,3 @@ User documentation for the Hub tool can be found [here] (https://hub.github.com/ 3. Modify the ```title``` variable in the shell script as the issue title you want to specify, e.g. "SEDS HW 1 Grade". 4. Once you are ready to send out the issues to _all_ the students, simply run the shell script. _NOTE: the hub command for creating issues will automatically copy the url of the new issue to your computer's clipboard. This can be avoided by using the alternative command provided in the script. However, you will get an error as the function tries to print the url to your terminal. The issue will still be created, but it will print the url and followed by 'No such file or directory'._ - - From a74471c48af467284aa85063effdb2f2e8a404e5 Mon Sep 17 00:00:00 2001 From: caitwolf Date: Thu, 24 Jan 2019 13:43:57 -0800 Subject: [PATCH 2/9] Updated README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7103f36..50e51ff 100644 --- a/README.md +++ b/README.md @@ -9,13 +9,13 @@ Scripts include: This script will batch submit the homeowrk grading issues for all github repos (student homework repos) in the current path. This is to be used after you have graded all the homework repos on your local machine by modifying the ```ISSUE_TEMPLATE.md``` file that is automatically generated in the homework repos. It eliminates the need to manually create an issue and fill out the grade online in github/github classroom. -### Installation of Required Tools +#### Installation of Required Tools The shell script relies on the ``` github/hub ``` tool to create issues by command line. Follow the [installation instructions](https://github.com/github/hub) found at their github page to install the tool on your device. User documentation for the Hub tool can be found [here](https://hub.github.com/hub.1.html). It extends many git commands and also provides new commands of its own. -### Usage +#### Usage 1. Download all the homework repos to your local machine. When grading the homework, modify the ```ISSUE_TEMPLATE.md``` file in each repo rather than making an issue through the github webiste. 2. Copy ```push_hw_issues.sh``` into the parent directory of all the homework repos. From f0e6134a2fce7f9a694b6ada4716c6e2ff215f85 Mon Sep 17 00:00:00 2001 From: caitwolf Date: Fri, 25 Jan 2019 11:08:25 -0800 Subject: [PATCH 3/9] Updated README.md for clarity of using the script --- README.md | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 50e51ff..1340f8c 100644 --- a/README.md +++ b/README.md @@ -3,22 +3,24 @@ Simple scripts to automate a bit of the homework grading process for instructors and TA's. Scripts include: -* ```batch_submit_issues.sh``` +* `batch_submit_issues.sh` ## batch_submit_issues.sh -This script will batch submit the homeowrk grading issues for all github repos (student homework repos) in the current path. This is to be used after you have graded all the homework repos on your local machine by modifying the ```ISSUE_TEMPLATE.md``` file that is automatically generated in the homework repos. It eliminates the need to manually create an issue and fill out the grade online in github/github classroom. +This script will batch submit the homework grades (github issues) for all the student homework repos. The script should be placed in the parent directory where you have all the homework repos stored locally. Grade all the homeworks by modifying the `ISSUE_TEMPLATE.md` file in each repo. Then, run the shell script _once_ in the parent directory (one level above all homework repos) to batch submit all the grades. See the __Usage__ section below for more details. #### Installation of Required Tools -The shell script relies on the ``` github/hub ``` tool to create issues by command line. Follow the [installation instructions](https://github.com/github/hub) found at their github page to install the tool on your device. +The shell script relies on the `github/hub` tool to create issues by command line. Follow the [installation instructions](https://github.com/github/hub) found at their github page to install the tool on your device. User documentation for the Hub tool can be found [here](https://hub.github.com/hub.1.html). It extends many git commands and also provides new commands of its own. #### Usage -1. Download all the homework repos to your local machine. When grading the homework, modify the ```ISSUE_TEMPLATE.md``` file in each repo rather than making an issue through the github webiste. -2. Copy ```push_hw_issues.sh``` into the parent directory of all the homework repos. -3. Modify the ```title``` variable in the shell script as the issue title you want to specify, e.g. "SEDS HW 1 Grade". -4. Once you are ready to send out the issues to _all_ the students, simply run the shell script. +1. Download all the homework repos to your local machine. Make sure to place them all into one _empty_ local directory. This will be the parent directory where the shell script is kept. +2. When grading the homework, modify the `ISSUE_TEMPLATE.md` file in each repo rather than making an issue through the github webiste. +3. Place `push_hw_issues.sh` into the parent directory where all the homework repos are stored (one level above each student's repo). You should only need one copy of this script. +_NOTE: only student homework repos can be located in this directory. The shell script moves into each sub-directory (homework repo) and tries to submit an issue. It will do this even for directories that are not github repos._ +4. Modify the `title` variable in the shell script as the issue title you want to specify, e.g. "SEDS HW 1 Grade". +5. Once you are ready to send out the issues to _all_ the students, simply run the shell script in the parent directory. _NOTE: the hub command for creating issues will automatically copy the url of the new issue to your computer's clipboard. This can be avoided by using the alternative command provided in the script. However, you will get an error as the function tries to print the url to your terminal. The issue will still be created, but it will print the url and followed by 'No such file or directory'._ From 21e99f3cfa90ffc049f6e66ee1251b0bd15526f6 Mon Sep 17 00:00:00 2001 From: caitwolf Date: Fri, 25 Jan 2019 11:09:03 -0800 Subject: [PATCH 4/9] Updated README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1340f8c..1fecc9d 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ User documentation for the Hub tool can be found [here](https://hub.github.com/h 1. Download all the homework repos to your local machine. Make sure to place them all into one _empty_ local directory. This will be the parent directory where the shell script is kept. 2. When grading the homework, modify the `ISSUE_TEMPLATE.md` file in each repo rather than making an issue through the github webiste. -3. Place `push_hw_issues.sh` into the parent directory where all the homework repos are stored (one level above each student's repo). You should only need one copy of this script. +3. Place `push_hw_issues.sh` into the parent directory where all the homework repos are stored (one level above each student's repo). You should only need one copy of this script. _NOTE: only student homework repos can be located in this directory. The shell script moves into each sub-directory (homework repo) and tries to submit an issue. It will do this even for directories that are not github repos._ 4. Modify the `title` variable in the shell script as the issue title you want to specify, e.g. "SEDS HW 1 Grade". 5. Once you are ready to send out the issues to _all_ the students, simply run the shell script in the parent directory. From 4b62ebd84961e12a1c84c503d275c3272db55900 Mon Sep 17 00:00:00 2001 From: Dave Beck Date: Fri, 25 Jan 2019 13:26:50 -0800 Subject: [PATCH 5/9] added support for supplying issue title by an argument and checking and skipping a dir if the ISSUE_TEMPLATE.md file is missing --- batch_submit_issues.sh | 49 ++++++++++++++++++++++++++++-------------- 1 file changed, 33 insertions(+), 16 deletions(-) diff --git a/batch_submit_issues.sh b/batch_submit_issues.sh index ff0eb39..6a467e2 100644 --- a/batch_submit_issues.sh +++ b/batch_submit_issues.sh @@ -1,32 +1,49 @@ #!/bin/bash -# Change variable 'title' to set a common name of all issues. -title="SEDS HW 1 Grade" +# +# +# + +# set variable 'title' to set a common name of all issues. +if [ "$1" != "" ]; then + title="$1" + echo "using '$title' as the issue title" +else + echo "usage: $0 " + exit 1 +fi + +# get a temporary file for preparing the issue text +tmpfile=$(mktemp /tmp/bash_submit_issues.sh.XXXXXXXXXX) || { echo "failed to create a tmp file"; exit 1; } # Issues will be sent for all github repos (homework repos) in this parent directory. # Alternatively, you can set a leading path to all the homework repos on your local machine. hwdir="`PWD`/*/" # loop through each student's homework repo in this directory -for i in $hwdir +for dir in $hwdir do -echo $i -cd $i + echo $dir + cd $dir -# A temporary file is needed to specify both issue title and content at once. -# The title needs to be the first line separated by an empty line from content. -echo $title > temp_issue_header.txt -echo "" >> temp_issue_header.txt -cat ISSUE_TEMPLATE.md >> temp_issue_header.txt + if [ ! -e ISSUE_TEMPLATE.md ]; then + echo "WARNING: unable to find an ISSUE_TEMPLATE.md file, skipping this directory..." + continue + fi -# removing the temporary file -`mv temp_issue_header.txt ISSUE_TEMPLATE.md` + # A temporary file is needed to specify both issue title and content at once. + # The title needs to be the first line separated by an empty line from content. + echo $title > $tmpfile + echo "" >> $tmpfile + cat ISSUE_TEMPLATE.md >> $tmpfile -# creating the issue, url of new issue will be copied to your computer clipboard -# using the alternative command will not copy to your clipboard, but will print an error line insted -`hub issue create -c -F ISSUE_TEMPLATE.md` -#`hub issue create -F ISSUE_TEMPLATE.md` # alternative command + # creating the issue, url of new issue will be copied to your computer clipboard + # using the alternative command will not copy to your clipboard, but will print an error line insted + #hub issue create -c -F $tmpfile + cat $tmpfile + # removing the temporary file + rm $tmpfile done From 15c22917d8717a2912ae708406b2099126321281 Mon Sep 17 00:00:00 2001 From: Dave Beck Date: Fri, 25 Jan 2019 13:28:05 -0800 Subject: [PATCH 6/9] added a comment on the script behavior --- batch_submit_issues.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/batch_submit_issues.sh b/batch_submit_issues.sh index 6a467e2..05416fa 100644 --- a/batch_submit_issues.sh +++ b/batch_submit_issues.sh @@ -1,7 +1,12 @@ #!/bin/bash # -# +# This script will batch submit the homeowrk grading issues for all github +# repos (student homework repos) in the current path. This is to be used +# after you have graded all the homework repos on your local machine by +# modifying the ```ISSUE_TEMPLATE.md``` file that is automatically generated +# in the homework repos. It eliminates the need to manually create an issue +# and fill out the grade online in github/github classroom. # # set variable 'title' to set a common name of all issues. From 7b6c68b88023446d7bff55e664bdf81f3ea918a0 Mon Sep 17 00:00:00 2001 From: Dave Beck Date: Fri, 25 Jan 2019 13:31:38 -0800 Subject: [PATCH 7/9] modified readme to reflect new behavior --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 50e51ff..7f662d7 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ User documentation for the Hub tool can be found [here](https://hub.github.com/h #### Usage 1. Download all the homework repos to your local machine. When grading the homework, modify the ```ISSUE_TEMPLATE.md``` file in each repo rather than making an issue through the github webiste. -2. Copy ```push_hw_issues.sh``` into the parent directory of all the homework repos. -3. Modify the ```title``` variable in the shell script as the issue title you want to specify, e.g. "SEDS HW 1 Grade". -4. Once you are ready to send out the issues to _all_ the students, simply run the shell script. +2. Copy ```batch_submit_issues.sh``` into the parent directory of all the homework repos. +3. Decide on your title for the issues, e.g. "SEDS HW1 Feedback" +4. Once you are ready to send out the issues to _all_ the students, simply run the shell script using your issue title as the first and only argument. Don't forget to use quotes to encapsulate the argument if it has spaces. _NOTE: the hub command for creating issues will automatically copy the url of the new issue to your computer's clipboard. This can be avoided by using the alternative command provided in the script. However, you will get an error as the function tries to print the url to your terminal. The issue will still be created, but it will print the url and followed by 'No such file or directory'._ From cdb2d4d60c1a218de81c3a2ecd8def9aeee080ce Mon Sep 17 00:00:00 2001 From: Dave Beck Date: Fri, 25 Jan 2019 13:37:27 -0800 Subject: [PATCH 8/9] removed debugging code --- batch_submit_issues.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/batch_submit_issues.sh b/batch_submit_issues.sh index 05416fa..33589ba 100644 --- a/batch_submit_issues.sh +++ b/batch_submit_issues.sh @@ -45,8 +45,9 @@ do # creating the issue, url of new issue will be copied to your computer clipboard # using the alternative command will not copy to your clipboard, but will print an error line insted - #hub issue create -c -F $tmpfile - cat $tmpfile + hub issue create -c -F $tmpfile + # uncomment below for debugging + # cat $tmpfile # removing the temporary file rm $tmpfile From 6801368fc1e0b7b41a6e53469a658e6e442cec38 Mon Sep 17 00:00:00 2001 From: Chad Curtis Date: Sat, 2 Feb 2019 17:37:54 -0800 Subject: [PATCH 9/9] Added script to print grades to shell. --- print_grade.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 print_grade.sh diff --git a/print_grade.sh b/print_grade.sh new file mode 100644 index 0000000..96c9518 --- /dev/null +++ b/print_grade.sh @@ -0,0 +1,12 @@ +# A quick utility script to print the grade from each repo +# after the grade has been filled in the ISSUE_TEMPLATE.md +# file. + +for d in ls -d */ +do + # print directory name + echo $d + # prints the 9th line of the ISSUE_TEMPLATE.md file. + # assumes the grade is on the 9th line of the file. + sed '9q;d' $d/ISSUE_TEMPLATE.md +done