Skip to content

Update check_files.yml #3

Update check_files.yml

Update check_files.yml #3

Workflow file for this run

name: Check Daily Submissions
on:
issues:
types: [opened, edited, labeled]
push:
branches:
- main
jobs:
check-submissions:
runs-on: ubuntu-latest
if: contains(github.event.issue.labels.*.name, 'day-')
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Get day label
id: get_day
run: |
# Extract day number from the label that starts with 'day-'
day_number=$(echo "${{ toJSON(github.event.issue.labels.*.name) }}" | grep -o 'day-[0-9]*' | grep -o '[0-9]*' | head -n1)
echo "day=$day_number" >> $GITHUB_OUTPUT
- name: Check for submissions count
id: check_files
run: |
day_folder="Day-${{ steps.get_day.outputs.day }}"
# Count the number of files in the day folder
file_count=$(ls "${day_folder}" 2>/dev/null | wc -l)
# Check if there are 5 or more files
if [ "$file_count" -ge 5 ]; then
echo "::set-output name=enough_submissions::true"
else
echo "::set-output name=enough_submissions::false"
fi
- name: Close issue if enough submissions
if: steps.check_files.outputs.enough_submissions == 'true'
uses: peter-evans/close-issue@v2
with:
issue-number: ${{ github.event.issue.number }}
comment: "5 or more submissions have been uploaded for this task. Marking it complete. ✅"
state: closed