GitHub Actions Weather Bot #49
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: GitHub Actions Weather Bot | |
# 触发条件:在 push 到 main 分支后 | |
on: | |
push: | |
schedule: | |
- cron: '0 21 * * *' | |
jobs: | |
bot: | |
runs-on: ubuntu-latest | |
steps: | |
- name: 'Check out the repository to the runner' | |
uses: actions/checkout@v4 | |
- name: 'Make the script files executable' | |
shell: bash | |
working-directory: ./.github/workflows | |
run: chmod +x weather.sh | |
- name: 'Get weather report' | |
working-directory: ./.github/workflows | |
shell: bash | |
run: | | |
./weather.sh | |
- name: 'Send mail' | |
uses: dawidd6/action-send-mail@master | |
with: | |
server_address: smtp.qq.com | |
server_port: 25 | |
username: ${{ secrets.MAILUSERNAME }} | |
password: ${{ secrets.MAILPASSWORD }} | |
from: XiNan GitHub Actions | |
to: [email protected],[email protected] | |
subject: Shenzhen Weather Report | |
html_body: file://./.github/workflows/result.html | |
# Optional carbon copy recipients: | |
# cc: [email protected],[email protected] | |
# Optional blind carbon copy recipients: | |
# bcc: [email protected],[email protected] | |
# Optional priority: 'high', 'normal' (default) or 'low' | |
# priority: low |