send-email.yml 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. name: Notify on Result
  2. on:
  3. push:
  4. branches:
  5. - main
  6. jobs:
  7. notify:
  8. runs-on: ubuntu-latest
  9. steps:
  10. - name: Checkout code
  11. uses: actions/checkout@v4
  12. - name: Setup Node.js
  13. uses: actions/setup-node@v4
  14. with:
  15. node-version: "20"
  16. registry-url: "https://registry.npmjs.org"
  17. - name: Install dependencies
  18. run: npm install
  19. - name: Run script
  20. id: run-script
  21. run: npm run fetch 2024
  22. - name: Read holidays file
  23. id: read-holidays
  24. run: |
  25. echo "HOLIDAYS_CONTENT=$(cat holidays.txt)" >> $GITHUB_ENV
  26. env:
  27. HOLIDAYS_CONTENT: $(cat holidays.txt)
  28. - name: Send notification if holidays has value
  29. if: ${{ steps.run-script.outputs.holidays != '' }}
  30. uses: dawidd6/action-send-mail@v3
  31. with:
  32. server_address: smtp.gmail.com
  33. server_port: 587
  34. username: ${{ secrets.EMAIL_USERNAME }}
  35. password: ${{ secrets.EMAIL_PASSWORD }}
  36. subject: "2024 Holidays Result has value - GitHub Actions"
  37. to: hi@yaavi.me
  38. from: Github
  39. body: |
  40. Result has value:
  41. ${{ env.HOLIDAYS_CONTENT }}