From 6dec7992a8f85496ba404d874ea8129a65a2777b Mon Sep 17 00:00:00 2001 From: l Date: Tue, 31 Mar 2026 14:10:57 +0100 Subject: [PATCH 01/18] Add expected answers and test yaml --- .github/workflows/test-sdc-tasks.yml | 59 ++++++++++++ .gitignore | 1 + .../individual-shell-tools/awk/script-01.sh | 6 ++ .../individual-shell-tools/awk/script-02.sh | 12 +++ .../individual-shell-tools/awk/script-03.sh | 6 ++ .../individual-shell-tools/awk/script-04.sh | 3 + .../individual-shell-tools/awk/script-05.sh | 6 ++ .../awk/script-06-stretch.sh | 1 + .../individual-shell-tools/awk/script-06.sh | 0 .../awk/script-07-stretch.sh | 6 ++ .../individual-shell-tools/cat/script-01.sh | 1 + .../individual-shell-tools/cat/script-02.sh | 5 ++ .../individual-shell-tools/cat/script-03.sh | 3 + .../cat/script-04-stretch.sh | 5 ++ .../individual-shell-tools/grep/script-01.sh | 6 ++ .../individual-shell-tools/grep/script-02.sh | 9 ++ .../individual-shell-tools/grep/script-03.sh | 1 + .../individual-shell-tools/grep/script-04.sh | 10 +++ .../individual-shell-tools/grep/script-05.sh | 5 ++ .../individual-shell-tools/grep/script-06.sh | 2 + .../individual-shell-tools/grep/script-07.sh | 3 + expect/individual-shell-tools/ls/script-01.sh | 5 ++ expect/individual-shell-tools/ls/script-02.sh | 3 + expect/individual-shell-tools/ls/script-03.sh | 11 +++ expect/individual-shell-tools/ls/script-04.sh | 8 ++ .../individual-shell-tools/sed/script-01.sh | 11 +++ .../individual-shell-tools/sed/script-02.sh | 11 +++ .../individual-shell-tools/sed/script-03.sh | 6 ++ .../individual-shell-tools/sed/script-04.sh | 11 +++ .../individual-shell-tools/sed/script-05.sh | 11 +++ .../individual-shell-tools/sed/script-06.sh | 11 +++ expect/individual-shell-tools/wc/script-01.sh | 1 + expect/individual-shell-tools/wc/script-02.sh | 1 + expect/individual-shell-tools/wc/script-03.sh | 4 + expect/jq/script-01.sh | 1 + expect/jq/script-02.sh | 1 + expect/jq/script-03.sh | 2 + expect/jq/script-04.sh | 6 ++ expect/jq/script-05.sh | 6 ++ expect/jq/script-06.sh | 6 ++ expect/jq/script-07.sh | 6 ++ expect/jq/script-08.sh | 6 ++ expect/jq/script-09.sh | 6 ++ expect/jq/script-10.sh | 1 + expect/jq/script-11.sh | 1 + expect/shell-pipelines/ls-grep/script-01.sh | 11 +++ expect/shell-pipelines/ls-grep/script-02.sh | 10 +++ expect/shell-pipelines/ls-grep/script-03.sh | 7 ++ expect/shell-pipelines/ls-grep/script-04.sh | 1 + .../sort-uniq-head-tail/script-01.sh | 6 ++ .../sort-uniq-head-tail/script-02.sh | 6 ++ .../sort-uniq-head-tail/script-03.sh | 3 + .../sort-uniq-head-tail/script-04.sh | 1 + .../sort-uniq-head-tail/script-05.sh | 6 ++ .../sort-uniq-head-tail/script-06.sh | 2 + .../sort-uniq-head-tail/script-07.sh | 2 + expect/shell-pipelines/tr/script-01.sh | 11 +++ expect/shell-pipelines/tr/script-02.sh | 11 +++ test-sdc.sh | 90 +++++++++++++++++++ 59 files changed, 453 insertions(+) create mode 100644 .github/workflows/test-sdc-tasks.yml create mode 100755 expect/individual-shell-tools/awk/script-01.sh create mode 100755 expect/individual-shell-tools/awk/script-02.sh create mode 100755 expect/individual-shell-tools/awk/script-03.sh create mode 100755 expect/individual-shell-tools/awk/script-04.sh create mode 100755 expect/individual-shell-tools/awk/script-05.sh create mode 100755 expect/individual-shell-tools/awk/script-06-stretch.sh create mode 100644 expect/individual-shell-tools/awk/script-06.sh create mode 100755 expect/individual-shell-tools/awk/script-07-stretch.sh create mode 100755 expect/individual-shell-tools/cat/script-01.sh create mode 100755 expect/individual-shell-tools/cat/script-02.sh create mode 100755 expect/individual-shell-tools/cat/script-03.sh create mode 100755 expect/individual-shell-tools/cat/script-04-stretch.sh create mode 100755 expect/individual-shell-tools/grep/script-01.sh create mode 100755 expect/individual-shell-tools/grep/script-02.sh create mode 100755 expect/individual-shell-tools/grep/script-03.sh create mode 100755 expect/individual-shell-tools/grep/script-04.sh create mode 100755 expect/individual-shell-tools/grep/script-05.sh create mode 100755 expect/individual-shell-tools/grep/script-06.sh create mode 100755 expect/individual-shell-tools/grep/script-07.sh create mode 100755 expect/individual-shell-tools/ls/script-01.sh create mode 100755 expect/individual-shell-tools/ls/script-02.sh create mode 100755 expect/individual-shell-tools/ls/script-03.sh create mode 100755 expect/individual-shell-tools/ls/script-04.sh create mode 100755 expect/individual-shell-tools/sed/script-01.sh create mode 100755 expect/individual-shell-tools/sed/script-02.sh create mode 100755 expect/individual-shell-tools/sed/script-03.sh create mode 100755 expect/individual-shell-tools/sed/script-04.sh create mode 100755 expect/individual-shell-tools/sed/script-05.sh create mode 100755 expect/individual-shell-tools/sed/script-06.sh create mode 100755 expect/individual-shell-tools/wc/script-01.sh create mode 100755 expect/individual-shell-tools/wc/script-02.sh create mode 100755 expect/individual-shell-tools/wc/script-03.sh create mode 100755 expect/jq/script-01.sh create mode 100755 expect/jq/script-02.sh create mode 100755 expect/jq/script-03.sh create mode 100755 expect/jq/script-04.sh create mode 100755 expect/jq/script-05.sh create mode 100755 expect/jq/script-06.sh create mode 100755 expect/jq/script-07.sh create mode 100755 expect/jq/script-08.sh create mode 100755 expect/jq/script-09.sh create mode 100755 expect/jq/script-10.sh create mode 100755 expect/jq/script-11.sh create mode 100755 expect/shell-pipelines/ls-grep/script-01.sh create mode 100755 expect/shell-pipelines/ls-grep/script-02.sh create mode 100755 expect/shell-pipelines/ls-grep/script-03.sh create mode 100755 expect/shell-pipelines/ls-grep/script-04.sh create mode 100755 expect/shell-pipelines/sort-uniq-head-tail/script-01.sh create mode 100755 expect/shell-pipelines/sort-uniq-head-tail/script-02.sh create mode 100755 expect/shell-pipelines/sort-uniq-head-tail/script-03.sh create mode 100755 expect/shell-pipelines/sort-uniq-head-tail/script-04.sh create mode 100755 expect/shell-pipelines/sort-uniq-head-tail/script-05.sh create mode 100755 expect/shell-pipelines/sort-uniq-head-tail/script-06.sh create mode 100755 expect/shell-pipelines/sort-uniq-head-tail/script-07.sh create mode 100755 expect/shell-pipelines/tr/script-01.sh create mode 100755 expect/shell-pipelines/tr/script-02.sh create mode 100755 test-sdc.sh diff --git a/.github/workflows/test-sdc-tasks.yml b/.github/workflows/test-sdc-tasks.yml new file mode 100644 index 000000000..30369deaf --- /dev/null +++ b/.github/workflows/test-sdc-tasks.yml @@ -0,0 +1,59 @@ +name: Test SDC Tasks + +on: + pull_request_target: + types: + - labeled + - unlabeled + - opened + - edited + - reopened + +jobs: + test_sdc_tasks: + + name: Test SDC Tasks + runs-on: ubuntu-slim + permissions: + pull-requests: write + + steps: + - name: checkout pushed PR + uses: actions/checkout@v5 + - name: Get changed files + id: changed-files + uses: tj-actions/changed-files@v47.0.5 + - name: test individual shell tools + if: contains(steps.changed-files.outputs.all_changed_files, 'individual-shell-tools/awk/script-01.sh') + run: ./test-sdc.sh individual-shell-tools + shell: bash + - name: test jq + if: contains(steps.changed-files.outputs.all_changed_files, 'jq/script-01.sh') + run: ./test-sdc.sh jq + shell: bash + - name: test shell-pipelines + if: contains(steps.changed-files.outputs.all_changed_files, 'shell-pipelines/ls-grep/script-01.sh') + run: ./test-sdc.sh shell-pipelines + shell: bash + - name: make output comment + if: contains(steps.changed-files.outputs.all_changed_files, 'individual-shell-tools/awk/script-01.sh') || contains(steps.changed-files.outputs.all_changed_files, 'jq/script-01.sh') || contains(steps.changed-files.outputs.all_changed_files, 'shell-pipelines/ls-grep/script-01.sh') + env: + GH_TOKEN: ${{ secrets.MY_TOKEN }} + ISSUE_URL: ${{ github.event.issue.html_url }} + run: | + gh issue comment $ISSUE_URL --body-FILE testoutput.TXT + - name: read test output + if: contains(steps.changed-files.outputs.all_changed_files, 'individual-shell-tools/awk/script-01.sh') || contains(steps.changed-files.outputs.all_changed_files, 'jq/script-01.sh') || contains(steps.changed-files.outputs.all_changed_files, 'shell-pipelines/ls-grep/script-01.sh') + id: read-test-output + run: | + echo 'testoutput<> $GITHUB_OUTPUT + cat testoutput.txt >> $GITHUB_OUTPUT + echo EOF >> $GITHUB_OUTPUT + - name: add appropriate labels + if: contains(steps.read-test-output.outputs.testoutput, 'complete!') + env: + GH_TOKEN: ${{ secrets.MY_TOKEN }} + ISSUE_URL: ${{ github.event.issue.html_url }} + run: | + gh issue edit $ISSUE_URL --add-label "Complete" + gh issue edit $ISSUE_URL --remove-label "Needs Review" diff --git a/.gitignore b/.gitignore index 3c3629e64..c4234ab74 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ node_modules +testoutput.txt diff --git a/expect/individual-shell-tools/awk/script-01.sh b/expect/individual-shell-tools/awk/script-01.sh new file mode 100755 index 000000000..050f04374 --- /dev/null +++ b/expect/individual-shell-tools/awk/script-01.sh @@ -0,0 +1,6 @@ +Ahmed +Basia +Mehmet +Leila +Piotr +Chandra diff --git a/expect/individual-shell-tools/awk/script-02.sh b/expect/individual-shell-tools/awk/script-02.sh new file mode 100755 index 000000000..44e2e83e2 --- /dev/null +++ b/expect/individual-shell-tools/awk/script-02.sh @@ -0,0 +1,12 @@ +Ahmed London +Basia London +Mehmet Birmingham +Leila London +Piotr Glasgow +Chandra Birmingham +Ahmed London +Basia London +Mehmet Birmingham +Leila London +Piotr Glasgow +Chandra Birmingham diff --git a/expect/individual-shell-tools/awk/script-03.sh b/expect/individual-shell-tools/awk/script-03.sh new file mode 100755 index 000000000..f5d0b1f03 --- /dev/null +++ b/expect/individual-shell-tools/awk/script-03.sh @@ -0,0 +1,6 @@ +Ahmed 1 +Basia 22 +Mehmet 3 +Leila 1 +Piotr 15 +Chandra 12 diff --git a/expect/individual-shell-tools/awk/script-04.sh b/expect/individual-shell-tools/awk/script-04.sh new file mode 100755 index 000000000..6e95a2f5c --- /dev/null +++ b/expect/individual-shell-tools/awk/script-04.sh @@ -0,0 +1,3 @@ +Ahmed 4 +Basia 6 +Leila 1 diff --git a/expect/individual-shell-tools/awk/script-05.sh b/expect/individual-shell-tools/awk/script-05.sh new file mode 100755 index 000000000..dd7e1d36c --- /dev/null +++ b/expect/individual-shell-tools/awk/script-05.sh @@ -0,0 +1,6 @@ +Ahmed 3 +Basia 3 +Mehmet 3 +Leila 1 +Piotr 5 +Chandra 2 diff --git a/expect/individual-shell-tools/awk/script-06-stretch.sh b/expect/individual-shell-tools/awk/script-06-stretch.sh new file mode 100755 index 000000000..fb1e7bc86 --- /dev/null +++ b/expect/individual-shell-tools/awk/script-06-stretch.sh @@ -0,0 +1 @@ +54 diff --git a/expect/individual-shell-tools/awk/script-06.sh b/expect/individual-shell-tools/awk/script-06.sh new file mode 100644 index 000000000..e69de29bb diff --git a/expect/individual-shell-tools/awk/script-07-stretch.sh b/expect/individual-shell-tools/awk/script-07-stretch.sh new file mode 100755 index 000000000..33ff777a7 --- /dev/null +++ b/expect/individual-shell-tools/awk/script-07-stretch.sh @@ -0,0 +1,6 @@ +Ahmed 15 +Basia 37 +Mehmet 32 +Leila 1 +Piotr 61 +Chandra 18 diff --git a/expect/individual-shell-tools/cat/script-01.sh b/expect/individual-shell-tools/cat/script-01.sh new file mode 100755 index 000000000..ed7bf7d08 --- /dev/null +++ b/expect/individual-shell-tools/cat/script-01.sh @@ -0,0 +1 @@ +Once upon a time... diff --git a/expect/individual-shell-tools/cat/script-02.sh b/expect/individual-shell-tools/cat/script-02.sh new file mode 100755 index 000000000..769b7e08c --- /dev/null +++ b/expect/individual-shell-tools/cat/script-02.sh @@ -0,0 +1,5 @@ +Once upon a time... +There was a house made of gingerbread. +It looked delicious. +I was tempted to take a bite of it. +But this seemed like a bad idea... diff --git a/expect/individual-shell-tools/cat/script-03.sh b/expect/individual-shell-tools/cat/script-03.sh new file mode 100755 index 000000000..f97bd500a --- /dev/null +++ b/expect/individual-shell-tools/cat/script-03.sh @@ -0,0 +1,3 @@ + 1 It looked delicious. + 2 I was tempted to take a bite of it. + 3 But this seemed like a bad idea... diff --git a/expect/individual-shell-tools/cat/script-04-stretch.sh b/expect/individual-shell-tools/cat/script-04-stretch.sh new file mode 100755 index 000000000..6f35e89d2 --- /dev/null +++ b/expect/individual-shell-tools/cat/script-04-stretch.sh @@ -0,0 +1,5 @@ + 1 Once upon a time... + 2 There was a house made of gingerbread. + 3 It looked delicious. + 4 I was tempted to take a bite of it. + 5 But this seemed like a bad idea... diff --git a/expect/individual-shell-tools/grep/script-01.sh b/expect/individual-shell-tools/grep/script-01.sh new file mode 100755 index 000000000..bc96ffe9e --- /dev/null +++ b/expect/individual-shell-tools/grep/script-01.sh @@ -0,0 +1,6 @@ +Doctor: Hello +Doctor: What's wrong today? +Doctor: That sounds frustrating. When did this start? +Doctor: Say "Hi". +Doctor: You didn't say hello +Doctor: You're welcome, goodbye diff --git a/expect/individual-shell-tools/grep/script-02.sh b/expect/individual-shell-tools/grep/script-02.sh new file mode 100755 index 000000000..bad606e1e --- /dev/null +++ b/expect/individual-shell-tools/grep/script-02.sh @@ -0,0 +1,9 @@ +Doctor: Hello +Patient: Hello Doctor +Doctor: What's wrong today? +Doctor: That sounds frustrating. When did this start? +Doctor: Say "Hi". +Doctor: You didn't say hello +Doctor: You're welcome, goodbye +Patient: I went to the doctor! +Spouse: I'm glad you saw the Doctor: did they cure you? diff --git a/expect/individual-shell-tools/grep/script-03.sh b/expect/individual-shell-tools/grep/script-03.sh new file mode 100755 index 000000000..ec635144f --- /dev/null +++ b/expect/individual-shell-tools/grep/script-03.sh @@ -0,0 +1 @@ +9 diff --git a/expect/individual-shell-tools/grep/script-04.sh b/expect/individual-shell-tools/grep/script-04.sh new file mode 100755 index 000000000..5814afa2a --- /dev/null +++ b/expect/individual-shell-tools/grep/script-04.sh @@ -0,0 +1,10 @@ +Doctor: What's wrong today? +Doctor: That sounds frustrating. When did this start? +Doctor: Say "Hi". +Patient: Hi +Patient: I seem to be cured! +Doctor: You're welcome, goodbye + +Patient: I went to the doctor! +Spouse: I'm glad you saw the Doctor: did they cure you? +Patient: Yes! diff --git a/expect/individual-shell-tools/grep/script-05.sh b/expect/individual-shell-tools/grep/script-05.sh new file mode 100755 index 000000000..2ed07ed20 --- /dev/null +++ b/expect/individual-shell-tools/grep/script-05.sh @@ -0,0 +1,5 @@ +Doctor: You didn't say hello +Patient: I seem to be cured! +-- +Patient: I went to the doctor! +Spouse: I'm glad you saw the Doctor: did they cure you? diff --git a/expect/individual-shell-tools/grep/script-06.sh b/expect/individual-shell-tools/grep/script-06.sh new file mode 100755 index 000000000..87b3a4f5e --- /dev/null +++ b/expect/individual-shell-tools/grep/script-06.sh @@ -0,0 +1,2 @@ +dialogue-2.txt +dialogue.txt diff --git a/expect/individual-shell-tools/grep/script-07.sh b/expect/individual-shell-tools/grep/script-07.sh new file mode 100755 index 000000000..aed78c634 --- /dev/null +++ b/expect/individual-shell-tools/grep/script-07.sh @@ -0,0 +1,3 @@ +dialogue-2.txt:2 +dialogue-3.txt:0 +dialogue.txt:6 diff --git a/expect/individual-shell-tools/ls/script-01.sh b/expect/individual-shell-tools/ls/script-01.sh new file mode 100755 index 000000000..dd590d624 --- /dev/null +++ b/expect/individual-shell-tools/ls/script-01.sh @@ -0,0 +1,5 @@ +child-directory +script-01.sh +script-02.sh +script-03.sh +script-04.sh diff --git a/expect/individual-shell-tools/ls/script-02.sh b/expect/individual-shell-tools/ls/script-02.sh new file mode 100755 index 000000000..bfd087e6a --- /dev/null +++ b/expect/individual-shell-tools/ls/script-02.sh @@ -0,0 +1,3 @@ +helper-1.txt +helper-2.txt +helper-3.txt diff --git a/expect/individual-shell-tools/ls/script-03.sh b/expect/individual-shell-tools/ls/script-03.sh new file mode 100755 index 000000000..36acd715f --- /dev/null +++ b/expect/individual-shell-tools/ls/script-03.sh @@ -0,0 +1,11 @@ +.: +child-directory +script-01.sh +script-02.sh +script-03.sh +script-04.sh + +./child-directory: +helper-1.txt +helper-2.txt +helper-3.txt diff --git a/expect/individual-shell-tools/ls/script-04.sh b/expect/individual-shell-tools/ls/script-04.sh new file mode 100755 index 000000000..86e7570ec --- /dev/null +++ b/expect/individual-shell-tools/ls/script-04.sh @@ -0,0 +1,8 @@ +First exercise (sorted newest to oldest): +helper-3.txt +helper-1.txt +helper-2.txt +Second exercise (sorted oldest to newest): +helper-2.txt +helper-1.txt +helper-3.txt diff --git a/expect/individual-shell-tools/sed/script-01.sh b/expect/individual-shell-tools/sed/script-01.sh new file mode 100755 index 000000000..d92b03ab0 --- /dev/null +++ b/expect/individual-shell-tools/sed/script-01.sh @@ -0,0 +1,11 @@ +ThIs Is a sample fIle for experImentIng wIth sed. + +It contaIns many lInes, and there are some thIngs you may want to do wIth each of them. + +We'll Include some score InformatIon: +37 AlIsha +15 Jacob +7 PIetro +3 Katya + +We also should remember, when we go shoppIng, to get 4 Items: oranges,cheese,bread,olIves. diff --git a/expect/individual-shell-tools/sed/script-02.sh b/expect/individual-shell-tools/sed/script-02.sh new file mode 100755 index 000000000..e326bd4ab --- /dev/null +++ b/expect/individual-shell-tools/sed/script-02.sh @@ -0,0 +1,11 @@ +This is a sample file for experimenting with sed. + +It contains many lines, and there are some things you may want to do with each of them. + +We'll include some score information: + Alisha + Jacob + Pietro + Katya + +We also should remember, when we go shopping, to get items: oranges,cheese,bread,olives. diff --git a/expect/individual-shell-tools/sed/script-03.sh b/expect/individual-shell-tools/sed/script-03.sh new file mode 100755 index 000000000..088b17d55 --- /dev/null +++ b/expect/individual-shell-tools/sed/script-03.sh @@ -0,0 +1,6 @@ +This is a sample file for experimenting with sed. + +It contains many lines, and there are some things you may want to do with each of them. + +We'll include some score information: + diff --git a/expect/individual-shell-tools/sed/script-04.sh b/expect/individual-shell-tools/sed/script-04.sh new file mode 100755 index 000000000..852fa1557 --- /dev/null +++ b/expect/individual-shell-tools/sed/script-04.sh @@ -0,0 +1,11 @@ +This is a sample file for experimenting with sed. + +It contains many lines, and there are some things you may want to do with each of them. + +We'll include some score information: +37 Alisha +15 Jacob +7 Pietro +3 Katya + +We also should remember, when we go shopping, to get 4 items: oranges,cheese,bread,olives. diff --git a/expect/individual-shell-tools/sed/script-05.sh b/expect/individual-shell-tools/sed/script-05.sh new file mode 100755 index 000000000..fe4d9d105 --- /dev/null +++ b/expect/individual-shell-tools/sed/script-05.sh @@ -0,0 +1,11 @@ +This is a sample file for experimenting with sed. + +It contains many lines, and there are some things you may want to do with each of them. + +We'll include some score information: +Alisha 37 +Jacob 15 +Pietro 7 +Katya 3 + +We also should remember, when we go shopping, to get 4 items: oranges,cheese,bread,olives. diff --git a/expect/individual-shell-tools/sed/script-06.sh b/expect/individual-shell-tools/sed/script-06.sh new file mode 100755 index 000000000..d9f950fec --- /dev/null +++ b/expect/individual-shell-tools/sed/script-06.sh @@ -0,0 +1,11 @@ +This is a sample file for experimenting with sed. + +It contains many lines, and there are some things you may want to do with each of them. + +We'll include some score information: +37 Alisha +15 Jacob +7 Pietro +3 Katya + +We also should remember, when we go shopping, to get 4 items: oranges, cheese, bread, olives. diff --git a/expect/individual-shell-tools/wc/script-01.sh b/expect/individual-shell-tools/wc/script-01.sh new file mode 100755 index 000000000..d1ad53e8b --- /dev/null +++ b/expect/individual-shell-tools/wc/script-01.sh @@ -0,0 +1 @@ +19 ../helper-files/helper-3.txt diff --git a/expect/individual-shell-tools/wc/script-02.sh b/expect/individual-shell-tools/wc/script-02.sh new file mode 100755 index 000000000..6bd060b79 --- /dev/null +++ b/expect/individual-shell-tools/wc/script-02.sh @@ -0,0 +1 @@ +3 ../helper-files/helper-3.txt diff --git a/expect/individual-shell-tools/wc/script-03.sh b/expect/individual-shell-tools/wc/script-03.sh new file mode 100755 index 000000000..572716a44 --- /dev/null +++ b/expect/individual-shell-tools/wc/script-03.sh @@ -0,0 +1,4 @@ + 1 4 20 ../helper-files/helper-1.txt + 1 7 39 ../helper-files/helper-2.txt + 3 19 92 ../helper-files/helper-3.txt + 5 30 151 total diff --git a/expect/jq/script-01.sh b/expect/jq/script-01.sh new file mode 100755 index 000000000..e16f4ed9b --- /dev/null +++ b/expect/jq/script-01.sh @@ -0,0 +1 @@ +Selma diff --git a/expect/jq/script-02.sh b/expect/jq/script-02.sh new file mode 100755 index 000000000..18711affa --- /dev/null +++ b/expect/jq/script-02.sh @@ -0,0 +1 @@ +35 Fashion Street, London, E1 6PX diff --git a/expect/jq/script-03.sh b/expect/jq/script-03.sh new file mode 100755 index 000000000..d63f6ec74 --- /dev/null +++ b/expect/jq/script-03.sh @@ -0,0 +1,2 @@ +Selma, Software Engineer +Selma, Software Engineer diff --git a/expect/jq/script-04.sh b/expect/jq/script-04.sh new file mode 100755 index 000000000..050f04374 --- /dev/null +++ b/expect/jq/script-04.sh @@ -0,0 +1,6 @@ +Ahmed +Basia +Mehmet +Leila +Piotr +Chandra diff --git a/expect/jq/script-05.sh b/expect/jq/script-05.sh new file mode 100755 index 000000000..ee7e0feb5 --- /dev/null +++ b/expect/jq/script-05.sh @@ -0,0 +1,6 @@ +Ahmed London +Basia London +Mehmet Birmingham +Leila London +Piotr Glasgow +Chandra Birmingham diff --git a/expect/jq/script-06.sh b/expect/jq/script-06.sh new file mode 100755 index 000000000..f5d0b1f03 --- /dev/null +++ b/expect/jq/script-06.sh @@ -0,0 +1,6 @@ +Ahmed 1 +Basia 22 +Mehmet 3 +Leila 1 +Piotr 15 +Chandra 12 diff --git a/expect/jq/script-07.sh b/expect/jq/script-07.sh new file mode 100755 index 000000000..59c783f1d --- /dev/null +++ b/expect/jq/script-07.sh @@ -0,0 +1,6 @@ +Ahmed 4 +Basia 6 +Mehmet 17 +Leila 1 +Piotr 8 +Chandra 6 diff --git a/expect/jq/script-08.sh b/expect/jq/script-08.sh new file mode 100755 index 000000000..dd7e1d36c --- /dev/null +++ b/expect/jq/script-08.sh @@ -0,0 +1,6 @@ +Ahmed 3 +Basia 3 +Mehmet 3 +Leila 1 +Piotr 5 +Chandra 2 diff --git a/expect/jq/script-09.sh b/expect/jq/script-09.sh new file mode 100755 index 000000000..33ff777a7 --- /dev/null +++ b/expect/jq/script-09.sh @@ -0,0 +1,6 @@ +Ahmed 15 +Basia 37 +Mehmet 32 +Leila 1 +Piotr 61 +Chandra 18 diff --git a/expect/jq/script-10.sh b/expect/jq/script-10.sh new file mode 100755 index 000000000..fb1e7bc86 --- /dev/null +++ b/expect/jq/script-10.sh @@ -0,0 +1 @@ +54 diff --git a/expect/jq/script-11.sh b/expect/jq/script-11.sh new file mode 100755 index 000000000..4e9bdff0c --- /dev/null +++ b/expect/jq/script-11.sh @@ -0,0 +1 @@ +164 diff --git a/expect/shell-pipelines/ls-grep/script-01.sh b/expect/shell-pipelines/ls-grep/script-01.sh new file mode 100755 index 000000000..5481774df --- /dev/null +++ b/expect/shell-pipelines/ls-grep/script-01.sh @@ -0,0 +1,11 @@ +Ariane +Daniel +HoChiMinh +KualaLumpur +Levi +London +NewYork +Niamh +Olga +York +dHondt diff --git a/expect/shell-pipelines/ls-grep/script-02.sh b/expect/shell-pipelines/ls-grep/script-02.sh new file mode 100755 index 000000000..35f2e44e6 --- /dev/null +++ b/expect/shell-pipelines/ls-grep/script-02.sh @@ -0,0 +1,10 @@ +Ariane +Daniel +HoChiMinh +KualaLumpur +Levi +London +NewYork +Niamh +Olga +York diff --git a/expect/shell-pipelines/ls-grep/script-03.sh b/expect/shell-pipelines/ls-grep/script-03.sh new file mode 100755 index 000000000..37ec45084 --- /dev/null +++ b/expect/shell-pipelines/ls-grep/script-03.sh @@ -0,0 +1,7 @@ +Ariane +Daniel +Levi +London +Niamh +Olga +York diff --git a/expect/shell-pipelines/ls-grep/script-04.sh b/expect/shell-pipelines/ls-grep/script-04.sh new file mode 100755 index 000000000..7f8f011eb --- /dev/null +++ b/expect/shell-pipelines/ls-grep/script-04.sh @@ -0,0 +1 @@ +7 diff --git a/expect/shell-pipelines/sort-uniq-head-tail/script-01.sh b/expect/shell-pipelines/sort-uniq-head-tail/script-01.sh new file mode 100755 index 000000000..a622bc929 --- /dev/null +++ b/expect/shell-pipelines/sort-uniq-head-tail/script-01.sh @@ -0,0 +1,6 @@ +Ahmed London 1 10 4 +Basia London 22 9 6 +Chandra Birmingham 12 6 +Leila London 1 +Mehmet Birmingham 3 12 17 +Piotr Glasgow 15 2 25 11 8 diff --git a/expect/shell-pipelines/sort-uniq-head-tail/script-02.sh b/expect/shell-pipelines/sort-uniq-head-tail/script-02.sh new file mode 100755 index 000000000..c560f609b --- /dev/null +++ b/expect/shell-pipelines/sort-uniq-head-tail/script-02.sh @@ -0,0 +1,6 @@ +Basia London 22 9 6 +Piotr Glasgow 15 2 25 11 8 +Chandra Birmingham 12 6 +Mehmet Birmingham 3 12 17 +Leila London 1 +Ahmed London 1 10 4 diff --git a/expect/shell-pipelines/sort-uniq-head-tail/script-03.sh b/expect/shell-pipelines/sort-uniq-head-tail/script-03.sh new file mode 100755 index 000000000..52d05bc65 --- /dev/null +++ b/expect/shell-pipelines/sort-uniq-head-tail/script-03.sh @@ -0,0 +1,3 @@ +Basia London 22 9 6 +Piotr Glasgow 15 2 25 11 8 +Chandra Birmingham 12 6 diff --git a/expect/shell-pipelines/sort-uniq-head-tail/script-04.sh b/expect/shell-pipelines/sort-uniq-head-tail/script-04.sh new file mode 100755 index 000000000..9c18f93d6 --- /dev/null +++ b/expect/shell-pipelines/sort-uniq-head-tail/script-04.sh @@ -0,0 +1 @@ +Piotr Glasgow 15 2 25 11 8 diff --git a/expect/shell-pipelines/sort-uniq-head-tail/script-05.sh b/expect/shell-pipelines/sort-uniq-head-tail/script-05.sh new file mode 100755 index 000000000..5b6440e3f --- /dev/null +++ b/expect/shell-pipelines/sort-uniq-head-tail/script-05.sh @@ -0,0 +1,6 @@ +Entry German +Entry Mariana +Entry Sally +Exit German +Exit Mariana +Exit Sally diff --git a/expect/shell-pipelines/sort-uniq-head-tail/script-06.sh b/expect/shell-pipelines/sort-uniq-head-tail/script-06.sh new file mode 100755 index 000000000..93bd06bc8 --- /dev/null +++ b/expect/shell-pipelines/sort-uniq-head-tail/script-06.sh @@ -0,0 +1,2 @@ + 5 Entry + 4 Exit diff --git a/expect/shell-pipelines/sort-uniq-head-tail/script-07.sh b/expect/shell-pipelines/sort-uniq-head-tail/script-07.sh new file mode 100755 index 000000000..93bd06bc8 --- /dev/null +++ b/expect/shell-pipelines/sort-uniq-head-tail/script-07.sh @@ -0,0 +1,2 @@ + 5 Entry + 4 Exit diff --git a/expect/shell-pipelines/tr/script-01.sh b/expect/shell-pipelines/tr/script-01.sh new file mode 100755 index 000000000..8dea4ebf2 --- /dev/null +++ b/expect/shell-pipelines/tr/script-01.sh @@ -0,0 +1,11 @@ +Dear Yara, + +Mz apologies for sending this response so late. As zou know, there's been a lot going on. + +Unfortunatelz I don't think I'll be able to make it to Yimbabwe, but but sounds amaying. + +Hope zou're doing well, and enjoz the trip. + +Thanks, + +Karolina diff --git a/expect/shell-pipelines/tr/script-02.sh b/expect/shell-pipelines/tr/script-02.sh new file mode 100755 index 000000000..e00561af1 --- /dev/null +++ b/expect/shell-pipelines/tr/script-02.sh @@ -0,0 +1,11 @@ +Dear Zara, + +My apologies for sending this response so late. As you know, there's been a lot going on! + +Unfortunately I don't think I'll be able to make it to Zimbabwe, but but sounds amazing! + +Hope you're doing well, and enjoy the trip! + +Thanks, + +Karolina diff --git a/test-sdc.sh b/test-sdc.sh new file mode 100755 index 000000000..2d5341e83 --- /dev/null +++ b/test-sdc.sh @@ -0,0 +1,90 @@ +# This test file will be automatically run when you submit a pull request +# You should not modify this file +# You can run this file using ./test-sdc.sh task-directory-name to check your output +# You can use it with the individual-shell-tools, jq, and shell-pipelines tasks + +rm testoutput.txt +if [[ "$1" == "individual-shell-tools" ]]; then + cd individual-shell-tools + pass=0 + total=0 + for directory in */; do + cd $directory + if [ "$directory" == "helper-files/" ]; then + cd .. + continue + fi + for exercise in *.sh; do + total=$(($total+1)) + ./$exercise > ../../test.tmp + cmp ../../test.tmp ../../expect/individual-shell-tools/$directory$exercise --quiet + if [ $? -eq 0 ]; then + pass=$(($pass+1)) + else + if [[ "$exercise" == *"stretch"* ]]; then + # echo "Stretch task $directory$exercise failing, you can ignore this if you did not attempt. If you didnt, please have the volunteer check this." + echo "" >> ../../testoutput.txt + total=$(($total-1)) + else + echo "Failed $directory$exercise, please either attempt again or have the volunteer check this." >> ../../testoutput.txt + fi + fi + done + cd .. + done + cd .. + rm test.tmp + echo "You passed $pass/$total tasks." >> testoutput.txt + if [ $pass -ge $total ]; then + echo "This task is complete!" >> testoutput.txt + fi + cat testoutput.txt +elif [[ "$1" == "shell-pipelines" ]]; then + cd shell-pipelines + pass=0 + total=0 + for directory in */; do + cd $directory + for exercise in *.sh; do + total=$(($total+1)) + ./$exercise > ../../test.tmp + cmp ../../test.tmp ../../expect/shell-pipelines/$directory$exercise --quiet + if [ $? -eq 0 ]; then + pass=$(($pass+1)) + else + echo "Failed $directory$exercise, please either attempt again or have the volunteer check this." >> ../../testoutput.txt + fi + done + cd .. + done + cd .. + rm test.tmp + echo "You passed $pass/$total tasks." >> testoutput.txt + if [ $pass -eq $total ]; then + echo "This task is complete!" >> testoutput.txt + fi + cat testoutput.txt +elif [[ "$1" == "jq" ]]; then + cd jq + pass=0 + total=0 + for exercise in *.sh; do + total=$(($total+1)) + ./$exercise > ../test.tmp + cmp ../test.tmp ../expect/jq/$exercise --quiet + if [ $? -eq 0 ]; then + pass=$(($pass+1)) + else + echo "Failed $directory$exercise, please either attempt again or have the volunteer check this." >> ../../testoutput.txt + fi + done + cd .. + rm test.tmp + echo "You passed $pass/$total tasks." >> testoutput.txt + if [ $pass -eq $total ]; then + echo "This task is complete!" >> testoutput.txt + fi + cat testoutput.txt +else + echo "Please run this with a valid test directory name as argument" +fi From da754c458d55229ec73cd89cb7e13fb280435b27 Mon Sep 17 00:00:00 2001 From: l Date: Tue, 31 Mar 2026 14:33:39 +0100 Subject: [PATCH 02/18] Simplify test yaml --- .github/workflows/test-sdc-tasks.yml | 15 ++++++--------- test-sdc.sh | 19 ++++++++++++++++++- 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/.github/workflows/test-sdc-tasks.yml b/.github/workflows/test-sdc-tasks.yml index 30369deaf..e2e992dba 100644 --- a/.github/workflows/test-sdc-tasks.yml +++ b/.github/workflows/test-sdc-tasks.yml @@ -8,6 +8,7 @@ on: - opened - edited - reopened + - synchronize jobs: test_sdc_tasks: @@ -24,33 +25,29 @@ jobs: id: changed-files uses: tj-actions/changed-files@v47.0.5 - name: test individual shell tools + id: test-individual-shell-tools if: contains(steps.changed-files.outputs.all_changed_files, 'individual-shell-tools/awk/script-01.sh') run: ./test-sdc.sh individual-shell-tools shell: bash - name: test jq + id: test-jq if: contains(steps.changed-files.outputs.all_changed_files, 'jq/script-01.sh') run: ./test-sdc.sh jq shell: bash - name: test shell-pipelines + id: test-shell-pipelines if: contains(steps.changed-files.outputs.all_changed_files, 'shell-pipelines/ls-grep/script-01.sh') run: ./test-sdc.sh shell-pipelines shell: bash - name: make output comment - if: contains(steps.changed-files.outputs.all_changed_files, 'individual-shell-tools/awk/script-01.sh') || contains(steps.changed-files.outputs.all_changed_files, 'jq/script-01.sh') || contains(steps.changed-files.outputs.all_changed_files, 'shell-pipelines/ls-grep/script-01.sh') + if: steps.test-individual-shell-tools.outputs.attempted == 'y' || steps.test-jq.outputs.attempted == 'y' || steps.test-shell-pipelines.outputs.attempted == 'y' env: GH_TOKEN: ${{ secrets.MY_TOKEN }} ISSUE_URL: ${{ github.event.issue.html_url }} run: | gh issue comment $ISSUE_URL --body-FILE testoutput.TXT - - name: read test output - if: contains(steps.changed-files.outputs.all_changed_files, 'individual-shell-tools/awk/script-01.sh') || contains(steps.changed-files.outputs.all_changed_files, 'jq/script-01.sh') || contains(steps.changed-files.outputs.all_changed_files, 'shell-pipelines/ls-grep/script-01.sh') - id: read-test-output - run: | - echo 'testoutput<> $GITHUB_OUTPUT - cat testoutput.txt >> $GITHUB_OUTPUT - echo EOF >> $GITHUB_OUTPUT - name: add appropriate labels - if: contains(steps.read-test-output.outputs.testoutput, 'complete!') + if: steps.test-individual-shell-tools.outputs.complete == 'y' || steps.test-jq.outputs.complete == 'y' || steps.test-shell-pipelines.outputs.complete == 'y' env: GH_TOKEN: ${{ secrets.MY_TOKEN }} ISSUE_URL: ${{ github.event.issue.html_url }} diff --git a/test-sdc.sh b/test-sdc.sh index 2d5341e83..f208705dc 100755 --- a/test-sdc.sh +++ b/test-sdc.sh @@ -23,7 +23,6 @@ if [[ "$1" == "individual-shell-tools" ]]; then else if [[ "$exercise" == *"stretch"* ]]; then # echo "Stretch task $directory$exercise failing, you can ignore this if you did not attempt. If you didnt, please have the volunteer check this." - echo "" >> ../../testoutput.txt total=$(($total-1)) else echo "Failed $directory$exercise, please either attempt again or have the volunteer check this." >> ../../testoutput.txt @@ -35,8 +34,14 @@ if [[ "$1" == "individual-shell-tools" ]]; then cd .. rm test.tmp echo "You passed $pass/$total tasks." >> testoutput.txt + if [ -v GITHUB_OUTPUT ]; then + echo "attempted=y" >> "$GITHUB_OUTPUT" + fi if [ $pass -ge $total ]; then echo "This task is complete!" >> testoutput.txt + if [ -v GITHUB_OUTPUT ]; then + echo "complete=y" >> "$GITHUB_OUTPUT" + fi fi cat testoutput.txt elif [[ "$1" == "shell-pipelines" ]]; then @@ -60,8 +65,14 @@ elif [[ "$1" == "shell-pipelines" ]]; then cd .. rm test.tmp echo "You passed $pass/$total tasks." >> testoutput.txt + if [ -v GITHUB_OUTPUT ]; then + echo "attempted=y" >> "$GITHUB_OUTPUT" + fi if [ $pass -eq $total ]; then echo "This task is complete!" >> testoutput.txt + if [ -v GITHUB_OUTPUT ]; then + echo "complete=y" >> "$GITHUB_OUTPUT" + fi fi cat testoutput.txt elif [[ "$1" == "jq" ]]; then @@ -81,8 +92,14 @@ elif [[ "$1" == "jq" ]]; then cd .. rm test.tmp echo "You passed $pass/$total tasks." >> testoutput.txt + if [ -v GITHUB_OUTPUT ]; then + echo "attempted=y" >> "$GITHUB_OUTPUT" + fi if [ $pass -eq $total ]; then echo "This task is complete!" >> testoutput.txt + if [ -v GITHUB_OUTPUT ]; then + echo "complete=y" >> "$GITHUB_OUTPUT" + fi fi cat testoutput.txt else From 43a83b77a537821107b9f1453462adf6f558f1fe Mon Sep 17 00:00:00 2001 From: l Date: Wed, 1 Apr 2026 10:42:15 +0100 Subject: [PATCH 03/18] add debug step --- .github/workflows/test-sdc-tasks.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/test-sdc-tasks.yml b/.github/workflows/test-sdc-tasks.yml index e2e992dba..f70d4c577 100644 --- a/.github/workflows/test-sdc-tasks.yml +++ b/.github/workflows/test-sdc-tasks.yml @@ -24,6 +24,13 @@ jobs: - name: Get changed files id: changed-files uses: tj-actions/changed-files@v47.0.5 + - name: List all changed files + env: + ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} + run: | + for file in ${ALL_CHANGED_FILES}; do + echo "$file was changed" + done - name: test individual shell tools id: test-individual-shell-tools if: contains(steps.changed-files.outputs.all_changed_files, 'individual-shell-tools/awk/script-01.sh') From 0aa66208c55dbe408d2562b3afae3e70c0b49e08 Mon Sep 17 00:00:00 2001 From: l Date: Wed, 1 Apr 2026 10:46:25 +0100 Subject: [PATCH 04/18] use correct changed files key --- .github/workflows/test-sdc-tasks.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test-sdc-tasks.yml b/.github/workflows/test-sdc-tasks.yml index f70d4c577..30fd3311f 100644 --- a/.github/workflows/test-sdc-tasks.yml +++ b/.github/workflows/test-sdc-tasks.yml @@ -33,17 +33,17 @@ jobs: done - name: test individual shell tools id: test-individual-shell-tools - if: contains(steps.changed-files.outputs.all_changed_files, 'individual-shell-tools/awk/script-01.sh') + if: contains(steps.changed-files.outputs.modified_files, 'individual-shell-tools/awk/script-01.sh') run: ./test-sdc.sh individual-shell-tools shell: bash - name: test jq id: test-jq - if: contains(steps.changed-files.outputs.all_changed_files, 'jq/script-01.sh') + if: contains(steps.changed-files.outputs.modified_files, 'jq/script-01.sh') run: ./test-sdc.sh jq shell: bash - name: test shell-pipelines id: test-shell-pipelines - if: contains(steps.changed-files.outputs.all_changed_files, 'shell-pipelines/ls-grep/script-01.sh') + if: contains(steps.changed-files.outputs.modified_files, 'shell-pipelines/ls-grep/script-01.sh') run: ./test-sdc.sh shell-pipelines shell: bash - name: make output comment From ba0cdb4bce1b91d40ae9ca1d5e9982c287e68627 Mon Sep 17 00:00:00 2001 From: l Date: Wed, 1 Apr 2026 10:52:14 +0100 Subject: [PATCH 05/18] get wider range of files --- .github/workflows/test-sdc-tasks.yml | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/.github/workflows/test-sdc-tasks.yml b/.github/workflows/test-sdc-tasks.yml index 30fd3311f..dc52bacca 100644 --- a/.github/workflows/test-sdc-tasks.yml +++ b/.github/workflows/test-sdc-tasks.yml @@ -24,26 +24,19 @@ jobs: - name: Get changed files id: changed-files uses: tj-actions/changed-files@v47.0.5 - - name: List all changed files - env: - ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} - run: | - for file in ${ALL_CHANGED_FILES}; do - echo "$file was changed" - done - name: test individual shell tools id: test-individual-shell-tools - if: contains(steps.changed-files.outputs.modified_files, 'individual-shell-tools/awk/script-01.sh') + if: contains(steps.changed-files.outputs.modified_files, 'individual-shell-tools/') run: ./test-sdc.sh individual-shell-tools shell: bash - name: test jq id: test-jq - if: contains(steps.changed-files.outputs.modified_files, 'jq/script-01.sh') + if: contains(steps.changed-files.outputs.modified_files, 'jq/') run: ./test-sdc.sh jq shell: bash - name: test shell-pipelines id: test-shell-pipelines - if: contains(steps.changed-files.outputs.modified_files, 'shell-pipelines/ls-grep/script-01.sh') + if: contains(steps.changed-files.outputs.modified_files, 'shell-pipelines/') run: ./test-sdc.sh shell-pipelines shell: bash - name: make output comment From 83f3c56fec9210666e1efafaabd157dc4590b064 Mon Sep 17 00:00:00 2001 From: l Date: Wed, 1 Apr 2026 10:58:22 +0100 Subject: [PATCH 06/18] clean up test results printing --- .github/workflows/test-sdc-tasks.yml | 2 +- test-sdc.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-sdc-tasks.yml b/.github/workflows/test-sdc-tasks.yml index dc52bacca..9547e38e8 100644 --- a/.github/workflows/test-sdc-tasks.yml +++ b/.github/workflows/test-sdc-tasks.yml @@ -45,7 +45,7 @@ jobs: GH_TOKEN: ${{ secrets.MY_TOKEN }} ISSUE_URL: ${{ github.event.issue.html_url }} run: | - gh issue comment $ISSUE_URL --body-FILE testoutput.TXT + gh issue comment $ISSUE_URL --body-file testoutput.txt - name: add appropriate labels if: steps.test-individual-shell-tools.outputs.complete == 'y' || steps.test-jq.outputs.complete == 'y' || steps.test-shell-pipelines.outputs.complete == 'y' env: diff --git a/test-sdc.sh b/test-sdc.sh index f208705dc..d5c33c4ac 100755 --- a/test-sdc.sh +++ b/test-sdc.sh @@ -3,7 +3,7 @@ # You can run this file using ./test-sdc.sh task-directory-name to check your output # You can use it with the individual-shell-tools, jq, and shell-pipelines tasks -rm testoutput.txt +echo "Results of test" > testoutput.txt if [[ "$1" == "individual-shell-tools" ]]; then cd individual-shell-tools pass=0 From 20c5a0f43b21dd93965b64b41dd5e6cb7b27bb7d Mon Sep 17 00:00:00 2001 From: l Date: Wed, 1 Apr 2026 11:16:52 +0100 Subject: [PATCH 07/18] break the yaml file --- .github/workflows/test-sdc-tasks.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-sdc-tasks.yml b/.github/workflows/test-sdc-tasks.yml index 9547e38e8..4106c915e 100644 --- a/.github/workflows/test-sdc-tasks.yml +++ b/.github/workflows/test-sdc-tasks.yml @@ -45,7 +45,7 @@ jobs: GH_TOKEN: ${{ secrets.MY_TOKEN }} ISSUE_URL: ${{ github.event.issue.html_url }} run: | - gh issue comment $ISSUE_URL --body-file testoutput.txt + gh issue comment $ISSUE_URL --body-ficle testoutput.txtc - name: add appropriate labels if: steps.test-individual-shell-tools.outputs.complete == 'y' || steps.test-jq.outputs.complete == 'y' || steps.test-shell-pipelines.outputs.complete == 'y' env: From ea02b261faee0dbf7e11802787a2dd820d89b9e5 Mon Sep 17 00:00:00 2001 From: l Date: Wed, 1 Apr 2026 11:17:22 +0100 Subject: [PATCH 08/18] refix the yaml file --- .github/workflows/test-sdc-tasks.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-sdc-tasks.yml b/.github/workflows/test-sdc-tasks.yml index 4106c915e..9547e38e8 100644 --- a/.github/workflows/test-sdc-tasks.yml +++ b/.github/workflows/test-sdc-tasks.yml @@ -45,7 +45,7 @@ jobs: GH_TOKEN: ${{ secrets.MY_TOKEN }} ISSUE_URL: ${{ github.event.issue.html_url }} run: | - gh issue comment $ISSUE_URL --body-ficle testoutput.txtc + gh issue comment $ISSUE_URL --body-file testoutput.txt - name: add appropriate labels if: steps.test-individual-shell-tools.outputs.complete == 'y' || steps.test-jq.outputs.complete == 'y' || steps.test-shell-pipelines.outputs.complete == 'y' env: From 5fd41f2b7923421bd3f7f37f133ac38160002c7e Mon Sep 17 00:00:00 2001 From: l Date: Wed, 1 Apr 2026 11:17:51 +0100 Subject: [PATCH 09/18] test capitalisation --- .github/workflows/test-sdc-tasks.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-sdc-tasks.yml b/.github/workflows/test-sdc-tasks.yml index 9547e38e8..ef80c1155 100644 --- a/.github/workflows/test-sdc-tasks.yml +++ b/.github/workflows/test-sdc-tasks.yml @@ -45,7 +45,7 @@ jobs: GH_TOKEN: ${{ secrets.MY_TOKEN }} ISSUE_URL: ${{ github.event.issue.html_url }} run: | - gh issue comment $ISSUE_URL --body-file testoutput.txt + gh issue comment $ISSUE_URL --body-file testoutput.TXT - name: add appropriate labels if: steps.test-individual-shell-tools.outputs.complete == 'y' || steps.test-jq.outputs.complete == 'y' || steps.test-shell-pipelines.outputs.complete == 'y' env: From 5093abe5f4134c0e4cfae9e7ccd447619d41cf59 Mon Sep 17 00:00:00 2001 From: l Date: Wed, 1 Apr 2026 11:18:35 +0100 Subject: [PATCH 10/18] refix the caps --- .github/workflows/test-sdc-tasks.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-sdc-tasks.yml b/.github/workflows/test-sdc-tasks.yml index ef80c1155..9547e38e8 100644 --- a/.github/workflows/test-sdc-tasks.yml +++ b/.github/workflows/test-sdc-tasks.yml @@ -45,7 +45,7 @@ jobs: GH_TOKEN: ${{ secrets.MY_TOKEN }} ISSUE_URL: ${{ github.event.issue.html_url }} run: | - gh issue comment $ISSUE_URL --body-file testoutput.TXT + gh issue comment $ISSUE_URL --body-file testoutput.txt - name: add appropriate labels if: steps.test-individual-shell-tools.outputs.complete == 'y' || steps.test-jq.outputs.complete == 'y' || steps.test-shell-pipelines.outputs.complete == 'y' env: From 997bd7744bb754af742bb1b9195cea1c04290e6f Mon Sep 17 00:00:00 2001 From: l Date: Wed, 1 Apr 2026 11:34:09 +0100 Subject: [PATCH 11/18] use pr event context --- .github/workflows/test-sdc-tasks.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test-sdc-tasks.yml b/.github/workflows/test-sdc-tasks.yml index 9547e38e8..feb2175e7 100644 --- a/.github/workflows/test-sdc-tasks.yml +++ b/.github/workflows/test-sdc-tasks.yml @@ -43,14 +43,14 @@ jobs: if: steps.test-individual-shell-tools.outputs.attempted == 'y' || steps.test-jq.outputs.attempted == 'y' || steps.test-shell-pipelines.outputs.attempted == 'y' env: GH_TOKEN: ${{ secrets.MY_TOKEN }} - ISSUE_URL: ${{ github.event.issue.html_url }} + ISSUE_URL: ${{ github.event.pull_request.html_url }} run: | - gh issue comment $ISSUE_URL --body-file testoutput.txt + gh pr comment $ISSUE_URL --body-file testoutput.txt - name: add appropriate labels if: steps.test-individual-shell-tools.outputs.complete == 'y' || steps.test-jq.outputs.complete == 'y' || steps.test-shell-pipelines.outputs.complete == 'y' env: GH_TOKEN: ${{ secrets.MY_TOKEN }} - ISSUE_URL: ${{ github.event.issue.html_url }} + ISSUE_URL: ${{ github.event.pull_request.html_url }} run: | - gh issue edit $ISSUE_URL --add-label "Complete" - gh issue edit $ISSUE_URL --remove-label "Needs Review" + gh pr edit $ISSUE_URL --add-label "Complete" + gh pr edit $ISSUE_URL --remove-label "Needs Review" From 04fa17bf0cc7acc67215de36b49672ab03555576 Mon Sep 17 00:00:00 2001 From: l Date: Wed, 1 Apr 2026 11:36:39 +0100 Subject: [PATCH 12/18] use correct token --- .github/workflows/test-sdc-tasks.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-sdc-tasks.yml b/.github/workflows/test-sdc-tasks.yml index feb2175e7..df9137ae4 100644 --- a/.github/workflows/test-sdc-tasks.yml +++ b/.github/workflows/test-sdc-tasks.yml @@ -42,14 +42,14 @@ jobs: - name: make output comment if: steps.test-individual-shell-tools.outputs.attempted == 'y' || steps.test-jq.outputs.attempted == 'y' || steps.test-shell-pipelines.outputs.attempted == 'y' env: - GH_TOKEN: ${{ secrets.MY_TOKEN }} + GH_TOKEN: ${{ github.token }} ISSUE_URL: ${{ github.event.pull_request.html_url }} run: | gh pr comment $ISSUE_URL --body-file testoutput.txt - name: add appropriate labels if: steps.test-individual-shell-tools.outputs.complete == 'y' || steps.test-jq.outputs.complete == 'y' || steps.test-shell-pipelines.outputs.complete == 'y' env: - GH_TOKEN: ${{ secrets.MY_TOKEN }} + GH_TOKEN: ${{ github.token }} ISSUE_URL: ${{ github.event.pull_request.html_url }} run: | gh pr edit $ISSUE_URL --add-label "Complete" From bbd54a6cf021945f74240016dcfae43b642c4a98 Mon Sep 17 00:00:00 2001 From: l Date: Wed, 1 Apr 2026 11:45:03 +0100 Subject: [PATCH 13/18] force red x on fail --- .github/workflows/test-sdc-tasks.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/test-sdc-tasks.yml b/.github/workflows/test-sdc-tasks.yml index df9137ae4..9d171d3c1 100644 --- a/.github/workflows/test-sdc-tasks.yml +++ b/.github/workflows/test-sdc-tasks.yml @@ -54,3 +54,7 @@ jobs: run: | gh pr edit $ISSUE_URL --add-label "Complete" gh pr edit $ISSUE_URL --remove-label "Needs Review" + - name: fail if not complete + if: (steps.test-individual-shell-tools.outputs.attempted == 'y' || steps.test-jq.outputs.attempted == 'y' || steps.test-shell-pipelines.outputs.attempted == 'y') && !(steps.test-individual-shell-tools.outputs.complete == 'y' || steps.test-jq.outputs.complete == 'y' || steps.test-shell-pipelines.outputs.complete == 'y') + run: | + exit -1 From 6465284bb6de089756983a38fce85f2b34ec7f71 Mon Sep 17 00:00:00 2001 From: l Date: Wed, 1 Apr 2026 11:56:01 +0100 Subject: [PATCH 14/18] add checkout step --- .github/workflows/test-sdc-tasks.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-sdc-tasks.yml b/.github/workflows/test-sdc-tasks.yml index 9d171d3c1..0b76d2358 100644 --- a/.github/workflows/test-sdc-tasks.yml +++ b/.github/workflows/test-sdc-tasks.yml @@ -19,11 +19,17 @@ jobs: pull-requests: write steps: - - name: checkout pushed PR + - name: checkout base branch uses: actions/checkout@v5 - name: Get changed files id: changed-files uses: tj-actions/changed-files@v47.0.5 + - name: checkout changed files + env: + GH_TOKEN: ${{ github.token }} + PR_NUM: ${{ github.event.pr.number }} + run: | + gh pr checkout $PR_NUM - name: test individual shell tools id: test-individual-shell-tools if: contains(steps.changed-files.outputs.modified_files, 'individual-shell-tools/') From 1059cbcf7c6de5fc14e7cd8536f9b23a3a268e32 Mon Sep 17 00:00:00 2001 From: l Date: Wed, 1 Apr 2026 11:58:45 +0100 Subject: [PATCH 15/18] be inconsistent because github --- .github/workflows/test-sdc-tasks.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-sdc-tasks.yml b/.github/workflows/test-sdc-tasks.yml index 0b76d2358..b505a63cd 100644 --- a/.github/workflows/test-sdc-tasks.yml +++ b/.github/workflows/test-sdc-tasks.yml @@ -27,7 +27,7 @@ jobs: - name: checkout changed files env: GH_TOKEN: ${{ github.token }} - PR_NUM: ${{ github.event.pr.number }} + PR_NUM: ${{ github.event.pull_request.number }} run: | gh pr checkout $PR_NUM - name: test individual shell tools From 77a85d08feefbbaaac252680697bdd6e890767a5 Mon Sep 17 00:00:00 2001 From: l Date: Wed, 1 Apr 2026 12:05:11 +0100 Subject: [PATCH 16/18] try normal pr target --- .github/workflows/test-sdc-tasks.yml | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/.github/workflows/test-sdc-tasks.yml b/.github/workflows/test-sdc-tasks.yml index b505a63cd..859f7e7bd 100644 --- a/.github/workflows/test-sdc-tasks.yml +++ b/.github/workflows/test-sdc-tasks.yml @@ -1,12 +1,10 @@ name: Test SDC Tasks on: - pull_request_target: + pull_request: types: - labeled - - unlabeled - opened - - edited - reopened - synchronize @@ -24,12 +22,6 @@ jobs: - name: Get changed files id: changed-files uses: tj-actions/changed-files@v47.0.5 - - name: checkout changed files - env: - GH_TOKEN: ${{ github.token }} - PR_NUM: ${{ github.event.pull_request.number }} - run: | - gh pr checkout $PR_NUM - name: test individual shell tools id: test-individual-shell-tools if: contains(steps.changed-files.outputs.modified_files, 'individual-shell-tools/') From 2f36a316c3e17e3fd83dac038d933998ada21aef Mon Sep 17 00:00:00 2001 From: LonMcGregor <3817332+LonMcGregor@users.noreply.github.com> Date: Mon, 6 Apr 2026 11:59:42 +0100 Subject: [PATCH 17/18] Create pull request action (#1) --- .github/workflows/test-sdc-tasks.yml | 4 +++- expect/individual-shell-tools/awk/script-02.sh | 6 ------ expect/individual-shell-tools/awk/script-06.sh | 0 3 files changed, 3 insertions(+), 7 deletions(-) delete mode 100644 expect/individual-shell-tools/awk/script-06.sh diff --git a/.github/workflows/test-sdc-tasks.yml b/.github/workflows/test-sdc-tasks.yml index 859f7e7bd..64654be66 100644 --- a/.github/workflows/test-sdc-tasks.yml +++ b/.github/workflows/test-sdc-tasks.yml @@ -3,10 +3,12 @@ name: Test SDC Tasks on: pull_request: types: - - labeled - opened + - labeled - reopened - synchronize + paths: + - '**.sh' jobs: test_sdc_tasks: diff --git a/expect/individual-shell-tools/awk/script-02.sh b/expect/individual-shell-tools/awk/script-02.sh index 44e2e83e2..ee7e0feb5 100755 --- a/expect/individual-shell-tools/awk/script-02.sh +++ b/expect/individual-shell-tools/awk/script-02.sh @@ -4,9 +4,3 @@ Mehmet Birmingham Leila London Piotr Glasgow Chandra Birmingham -Ahmed London -Basia London -Mehmet Birmingham -Leila London -Piotr Glasgow -Chandra Birmingham diff --git a/expect/individual-shell-tools/awk/script-06.sh b/expect/individual-shell-tools/awk/script-06.sh deleted file mode 100644 index e69de29bb..000000000 From c6dc9c49b65fb7430821b4956ca5bb2d9bd1ee85 Mon Sep 17 00:00:00 2001 From: LonMcGregor <3817332+LonMcGregor@users.noreply.github.com> Date: Tue, 7 Apr 2026 14:52:11 +0100 Subject: [PATCH 18/18] Lm binary task action (#2) * number-systems qanda formatting * numbers-expected * num sys checker * tests for numsys * fix diffing * test bin task action * finalise readme for merge --------- Co-authored-by: l --- .github/workflows/test-sdc-tasks.yml | 7 ++- expect/number-systems/README.json | 1 + number-systems/README.md | 82 ++++++++++++++-------------- test-sdc.sh | 27 +++++++++ 4 files changed, 75 insertions(+), 42 deletions(-) create mode 100644 expect/number-systems/README.json diff --git a/.github/workflows/test-sdc-tasks.yml b/.github/workflows/test-sdc-tasks.yml index 64654be66..e251e526e 100644 --- a/.github/workflows/test-sdc-tasks.yml +++ b/.github/workflows/test-sdc-tasks.yml @@ -39,8 +39,13 @@ jobs: if: contains(steps.changed-files.outputs.modified_files, 'shell-pipelines/') run: ./test-sdc.sh shell-pipelines shell: bash + - name: test number-systems + id: test-number-systems + if: contains(steps.changed-files.outputs.modified_files, 'number-systems/') + run: ./test-sdc.sh number-systems + shell: bash - name: make output comment - if: steps.test-individual-shell-tools.outputs.attempted == 'y' || steps.test-jq.outputs.attempted == 'y' || steps.test-shell-pipelines.outputs.attempted == 'y' + if: steps.test-individual-shell-tools.outputs.attempted == 'y' || steps.test-jq.outputs.attempted == 'y' || steps.test-shell-pipelines.outputs.attempted == 'y' || steps.test-number-systems.outputs.attempted == 'y' env: GH_TOKEN: ${{ github.token }} ISSUE_URL: ${{ github.event.pull_request.html_url }} diff --git a/expect/number-systems/README.json b/expect/number-systems/README.json new file mode 100644 index 000000000..f4bf38f5d --- /dev/null +++ b/expect/number-systems/README.json @@ -0,0 +1 @@ +{"answers": [0, 1110, 45, 1000, "01011", 11111, 100010, 15, 8, 2, "(10$|10[^0-9])", "VOLUNTEER_CHECK", "E", 182, 902, 11, 33, "VOLUNTEER_CHECK", "VOLUNTEER_CHECK", "VOLUNTEER_CHECK", "VOLUNTEER_CHECK"]} diff --git a/number-systems/README.md b/number-systems/README.md index 77a3bde94..cb7ad070a 100644 --- a/number-systems/README.md +++ b/number-systems/README.md @@ -4,62 +4,62 @@ Do not convert any binary numbers to decimal when solving a question unless the The goal of these exercises is for you to gain an intuition for binary numbers. Using tools to solve the problems defeats the point. -Convert the decimal number 14 to binary. -Answer: +Q1: Convert the decimal number 14 to binary. +Answer: -Convert the binary number 101101 to decimal: -Answer: +Q2: Convert the binary number 101101 to decimal: +Answer: -Which is larger: 1000 or 0111? -Answer: +Q3: Which is larger: 1000 or 0111? +Answer: -Which is larger: 00100 or 01011? -Answer: +Q4: Which is larger: 00100 or 01011? +Answer: -What is 10101 + 01010? -Answer: +Q5: What is 10101 + 01010? +Answer: -What is 10001 + 10001? -Answer: +Q6: What is 10001 + 10001? +Answer: -What's the largest number you can store with 4 bits, if you want to be able to represent the number 0? -Answer: +Q7: What's the largest number you can store with 4 bits, if you want to be able to represent the number 0? +Answer: -How many bits would you need in order to store the numbers between 0 and 255 inclusive? -Answer: +Q8: How many bits would you need in order to store the numbers between 0 and 255 inclusive? +Answer: -How many bits would you need in order to store the numbers between 0 and 3 inclusive? -Answer: +Q9: How many bits would you need in order to store the numbers between 0 and 3 inclusive? +Answer: -How many bits would you need in order to store the numbers between 0 and 1000 inclusive? -Answer: +Q10: How many bits would you need in order to store the numbers between 0 and 1000 inclusive? +Answer: -How can you test if a binary number is a power of two (e.g. 1, 2, 4, 8, 16, ...)? -Answer: +Q11: How can you test if a binary number is a power of two (e.g. 1, 2, 4, 8, 16, ...)? +Answer: -Convert the decimal number 14 to hex. -Answer: +Q12: Convert the decimal number 14 to hex. +Answer: + +Q13: Convert the decimal number 386 to hex. +Answer: -Convert the decimal number 386 to hex. -Answer: +Q14: Convert the hex number 386 to decimal. +Answer: -Convert the hex number 386 to decimal. -Answer: +Q15: Convert the hex number B to decimal. +Answer: -Convert the hex number B to decimal. -Answer: +Q16: If reading the byte 0x21 as a number, what decimal number would it mean? +Answer: -If reading the byte 0x21 as a number, what decimal number would it mean? -Answer: +Q17: If reading the byte 0x21 as an ASCII character, what character would it mean? +Answer: -If reading the byte 0x21 as an ASCII character, what character would it mean? -Answer: +Q18: If reading the byte 0x21 as a greyscale colour, as described in "Approaches for Representing Colors and Images", what colour would it mean? +Answer: -If reading the byte 0x21 as a greyscale colour, as described in "Approaches for Representing Colors and Images", what colour would it mean? -Answer: +Q19: If reading the bytes 0xAA00FF as an RGB colour, as described in "Approaches for Representing Colors and Images", what colour would it mean? +Answer: -If reading the bytes 0xAA00FF as an RGB colour, as described in "Approaches for Representing Colors and Images", what colour would it mean? -Answer: - -If reading the bytes 0xAA00FF as a sequence of three one-byte decimal numbers, what decimal numbers would they be? -Answer: +Q20: If reading the bytes 0xAA00FF as a sequence of three one-byte decimal numbers, what decimal numbers would they be? +Answer: diff --git a/test-sdc.sh b/test-sdc.sh index d5c33c4ac..d4bd15de9 100755 --- a/test-sdc.sh +++ b/test-sdc.sh @@ -102,6 +102,33 @@ elif [[ "$1" == "jq" ]]; then fi fi cat testoutput.txt +elif [[ "$1" == "number-systems" ]]; then + pass=0 + for question in $(seq 1 17); do + answer=$(jq -r ".answers[$question]" expect/number-systems/README.json) + if [[ "$answer" == "VOLUNTEER_CHECK" ]]; then + continue + fi + nextq=$(($question+1)) + Q_START=$(grep -n "Q$question:" number-systems/README.md | cut -d: -f1) + ANS_START=$(($Q_START + 1)) + NEXT_Q_START=$(grep -n "Q$nextq:" number-systems/README.md | cut -d: -f1) + ANS_END=$(($NEXT_Q_START - 1)) + sed -n "$ANS_START,${ANS_END}p;${NEXT_Q_START}q" number-systems/README.md | cut -d: -f2- > answerfile + grep --quiet -iE $answer answerfile + if [ $? -eq 0 ]; then + pass=$(($pass+1)) + else + echo "Please try Q$question again, or have the volunteer check this." >> testoutput.txt + fi + rm answerfile + done + echo "You passed $pass/20 tasks." >> testoutput.txt + if [ -v GITHUB_OUTPUT ]; then + echo "attempted=y" >> "$GITHUB_OUTPUT" + fi + echo "Please let a volunteer check the answers for questions 11, 17, 18, 19, and 20." + cat testoutput.txt else echo "Please run this with a valid test directory name as argument" fi