send-email.yml 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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: Debug secrets
  23. run: echo "SECRET_TEST=${{ secrets.SECRET_TEST }}"
  24. shell: bash
  25. - name: Send notification if holidays has value
  26. if: ${{ steps.run-script.outputs.holidays != '' }}
  27. uses: dawidd6/action-send-mail@v3
  28. with:
  29. server_address: smtp.gmail.com
  30. server_port: 587
  31. username: ${{ secrets.EMAIL_USERNAME }}
  32. password: ${{ secrets.EMAIL_PASSWORD }}
  33. subject: "2024 Holidays Result has value - GitHub Actions"
  34. to: hi@yaavi.me
  35. from: Github
  36. body: |
  37. Result has value: $(cat holidays.txt)