Skip to content

Commit d3857c2

Browse files
authored
Improve cowsay comments (#522)
* Trigger on added files - Cowsay involves writing brand new files * Hide previous comments * Fix completed -> complete * Clean up output a little
1 parent ab33fa5 commit d3857c2

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

.github/workflows/validate-pr-metadata.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ jobs:
5050
shell: bash
5151
- name: test implement-cowsay
5252
id: test-implement-cowsay
53-
if: contains(steps.changed-files.outputs.modified_files, 'implement-cowsay/')
53+
if: contains(steps.changed-files.outputs.all_modified_files, 'implement-cowsay/')
5454
run: ./test-sdc.sh implement-cowsay
5555
shell: bash
5656
- name: make output comment
@@ -59,6 +59,8 @@ jobs:
5959
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6060
ISSUE_URL: ${{ github.event.pull_request.html_url }}
6161
run: |
62+
gh release -R CodeYourFuture/trainee-tracker view --json assets -q ".assets[] | select(.name | startswith(\"pr-metadata-validator-musl-\")).url" | xargs curl --fail -L -o /tmp/pr-metadata-validator && chmod 0755 /tmp/pr-metadata-validator
63+
/tmp/pr-metadata-validator --only-close-existing-comments-with-tag="sdc-test-results" "${ISSUE_URL}"
6264
gh pr comment $ISSUE_URL --body-file testoutput.txt
6365
- name: add appropriate labels
6466
if: steps.test-individual-shell-tools.outputs.complete == 'y' || steps.test-jq.outputs.complete == 'y' || steps.test-shell-pipelines.outputs.complete == 'y' || steps.test-implement-cowsay.outputs.complete == 'y'

test-sdc.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# You can run this file using ./test-sdc.sh task-directory-name to check your output
66

77
echo "<!--CYFTT tag: sdc-test-results-->" > testoutput.txt
8-
echo "Results of test" >> testoutput.txt
8+
echo "Results of test:" >> testoutput.txt
99

1010
if [[ "$1" == "individual-shell-tools" ]]; then
1111
cd individual-shell-tools
@@ -148,14 +148,14 @@ elif [[ "$1" == "implement-cowsay" ]]; then
148148
python3 implement-cowsay/cow.py Grass, delicious > test.tmp
149149
cmp test.tmp expect/implement-cowsay/cow-grass.txt
150150
if [ $? -ne 0 ]; then
151-
echo "Unexpected cowsay output for Grass, delicious" >> testoutput.txt
151+
echo "Unexpected cowsay output for 'Grass, delicious'." >> testoutput.txt
152152
all_ok=false
153153
fi
154154

155155
python3 implement-cowsay/cow.py --animal turtle "Fish are cool!" > test.tmp
156156
cmp test.tmp expect/implement-cowsay/turtle-fish.txt
157157
if [ $? -ne 0 ]; then
158-
echo "Unexpected cowsay output for Fish are cool!" >> testoutput.txt
158+
echo "Unexpected cowsay output for --animal turtle Fish are cool!" >> testoutput.txt
159159
all_ok=false
160160
fi
161161

@@ -172,7 +172,8 @@ elif [[ "$1" == "implement-cowsay" ]]; then
172172
fi
173173

174174
if [[ "${all_ok}" == "true" && -v GITHUB_OUTPUT ]]; then
175-
echo "completed=y" >> "$GITHUB_OUTPUT"
175+
echo "complete=y" >> "$GITHUB_OUTPUT"
176+
echo "Your implementation passed all checks." >> testoutput.txt
176177
fi
177178
fi
178179
fi

0 commit comments

Comments
 (0)