Update feedback.md #86
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Essay Word Count | |
'on': | |
pull_request: | |
workflow_dispatch: {} | |
jobs: | |
check-essay: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install xpdf | |
run: > | |
sudo apt-get update; | |
sudo apt-get install -y xpdf | |
- id: file_changes | |
uses: trilom/[email protected] | |
- name: Check the submitted essays | |
run: > | |
added_files='${{ steps.file_changes.outputs.files_added }},${{ steps.file_changes.outputs.files_modified }}'; | |
added_files=${added_files//\"/}; | |
added_files=${added_files//[/}; | |
added_files=${added_files//]/}; | |
added_files=${added_files// /;}; | |
added_files=${added_files//,/ }; | |
for item in ${added_files[@]}; do | |
added_file=${item//;/ }; | |
echo "Checking file: $added_file" | |
if [[ "$added_file" == *"contributions/essay/"* ]] && [[ "$added_file" == *"pdf" ]] ; then | |
words_with_periods=$(sudo pdftotext "${added_file}" - | wc -w) | |
words_without_periods=$(sudo pdftotext "${added_file}" - | tr -d '.' | wc -w) | |
echo "File $added_file has $words_with_periods words with periods and $words_without_periods without periods" | |
if [[ ($words_with_periods -lt 1200 || $words_with_periods -gt 2600) && ($words_without_periods -lt 1200 || $words_without_periods -gt 2600) ]]; then | |
exit 1 | |
fi | |
fi | |
done |