Skip to content

Commit da754c4

Browse files
author
l
committed
Simplify test yaml
1 parent 6dec799 commit da754c4

File tree

2 files changed

+24
-10
lines changed

2 files changed

+24
-10
lines changed

.github/workflows/test-sdc-tasks.yml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88
- opened
99
- edited
1010
- reopened
11+
- synchronize
1112

1213
jobs:
1314
test_sdc_tasks:
@@ -24,33 +25,29 @@ jobs:
2425
id: changed-files
2526
uses: tj-actions/changed-files@v47.0.5
2627
- name: test individual shell tools
28+
id: test-individual-shell-tools
2729
if: contains(steps.changed-files.outputs.all_changed_files, 'individual-shell-tools/awk/script-01.sh')
2830
run: ./test-sdc.sh individual-shell-tools
2931
shell: bash
3032
- name: test jq
33+
id: test-jq
3134
if: contains(steps.changed-files.outputs.all_changed_files, 'jq/script-01.sh')
3235
run: ./test-sdc.sh jq
3336
shell: bash
3437
- name: test shell-pipelines
38+
id: test-shell-pipelines
3539
if: contains(steps.changed-files.outputs.all_changed_files, 'shell-pipelines/ls-grep/script-01.sh')
3640
run: ./test-sdc.sh shell-pipelines
3741
shell: bash
3842
- name: make output comment
39-
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')
43+
if: steps.test-individual-shell-tools.outputs.attempted == 'y' || steps.test-jq.outputs.attempted == 'y' || steps.test-shell-pipelines.outputs.attempted == 'y'
4044
env:
4145
GH_TOKEN: ${{ secrets.MY_TOKEN }}
4246
ISSUE_URL: ${{ github.event.issue.html_url }}
4347
run: |
4448
gh issue comment $ISSUE_URL --body-FILE testoutput.TXT
45-
- name: read test output
46-
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')
47-
id: read-test-output
48-
run: |
49-
echo 'testoutput<<EOF' >> $GITHUB_OUTPUT
50-
cat testoutput.txt >> $GITHUB_OUTPUT
51-
echo EOF >> $GITHUB_OUTPUT
5249
- name: add appropriate labels
53-
if: contains(steps.read-test-output.outputs.testoutput, 'complete!')
50+
if: steps.test-individual-shell-tools.outputs.complete == 'y' || steps.test-jq.outputs.complete == 'y' || steps.test-shell-pipelines.outputs.complete == 'y'
5451
env:
5552
GH_TOKEN: ${{ secrets.MY_TOKEN }}
5653
ISSUE_URL: ${{ github.event.issue.html_url }}

test-sdc.sh

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ if [[ "$1" == "individual-shell-tools" ]]; then
2323
else
2424
if [[ "$exercise" == *"stretch"* ]]; then
2525
# echo "Stretch task $directory$exercise failing, you can ignore this if you did not attempt. If you didnt, please have the volunteer check this."
26-
echo "" >> ../../testoutput.txt
2726
total=$(($total-1))
2827
else
2928
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
3534
cd ..
3635
rm test.tmp
3736
echo "You passed $pass/$total tasks." >> testoutput.txt
37+
if [ -v GITHUB_OUTPUT ]; then
38+
echo "attempted=y" >> "$GITHUB_OUTPUT"
39+
fi
3840
if [ $pass -ge $total ]; then
3941
echo "This task is complete!" >> testoutput.txt
42+
if [ -v GITHUB_OUTPUT ]; then
43+
echo "complete=y" >> "$GITHUB_OUTPUT"
44+
fi
4045
fi
4146
cat testoutput.txt
4247
elif [[ "$1" == "shell-pipelines" ]]; then
@@ -60,8 +65,14 @@ elif [[ "$1" == "shell-pipelines" ]]; then
6065
cd ..
6166
rm test.tmp
6267
echo "You passed $pass/$total tasks." >> testoutput.txt
68+
if [ -v GITHUB_OUTPUT ]; then
69+
echo "attempted=y" >> "$GITHUB_OUTPUT"
70+
fi
6371
if [ $pass -eq $total ]; then
6472
echo "This task is complete!" >> testoutput.txt
73+
if [ -v GITHUB_OUTPUT ]; then
74+
echo "complete=y" >> "$GITHUB_OUTPUT"
75+
fi
6576
fi
6677
cat testoutput.txt
6778
elif [[ "$1" == "jq" ]]; then
@@ -81,8 +92,14 @@ elif [[ "$1" == "jq" ]]; then
8192
cd ..
8293
rm test.tmp
8394
echo "You passed $pass/$total tasks." >> testoutput.txt
95+
if [ -v GITHUB_OUTPUT ]; then
96+
echo "attempted=y" >> "$GITHUB_OUTPUT"
97+
fi
8498
if [ $pass -eq $total ]; then
8599
echo "This task is complete!" >> testoutput.txt
100+
if [ -v GITHUB_OUTPUT ]; then
101+
echo "complete=y" >> "$GITHUB_OUTPUT"
102+
fi
86103
fi
87104
cat testoutput.txt
88105
else

0 commit comments

Comments
 (0)