Daily File Check #362
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: Daily File Check | |
on: | |
schedule: | |
- cron: '0 8 * * *' | |
workflow_dispatch: # Allows manual triggering of the workflow | |
jobs: | |
check-files: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.x' # Use the latest version of Python 3 | |
- name: Install Dependencies | |
run: | | |
pip install GitPython | |
- name: Check for Specific Files | |
id: check_files | |
run: | | |
python ./.github/scripts/check-files.py | |
if [ -s links_to_check.txt ]; then | |
echo "::set-output name=has_files::true" | |
else | |
echo "::set-output name=has_files::false" | |
fi | |
- name: Send Email with Links if Files to Revisit | |
if: steps.check_files.outputs.has_files == 'true' | |
uses: dawidd6/action-send-mail@v2 | |
with: | |
server_address: smtp.gmail.com | |
server_port: 587 | |
username: ${{ secrets.EMAIL_USERNAME }} | |
password: ${{ secrets.EMAIL_PASSWORD }} | |
subject: Files to Revisit | |
to: ${{ secrets.USER_EMAIL }} | |
from: GitHub Actions | |
body: file://links_to_check.txt | |
content_type: text/html | |
- name: Send Email if No Files to Revisit | |
if: steps.check_files.outputs.has_files == 'false' | |
uses: dawidd6/action-send-mail@v2 | |
with: | |
server_address: smtp.gmail.com | |
server_port: 587 | |
username: ${{ secrets.EMAIL_USERNAME }} | |
password: ${{ secrets.EMAIL_PASSWORD }} | |
subject: Yayyy!!! No Questions to Visit Today | |
to: ${{ secrets.USER_EMAIL }} | |
from: GitHub Actions | |
body: 'Yayyy!!! no questions to visit today' |