GitHub Actions Weather Bot #282
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' | |
on: | |
watch: | |
types: started | |
schedule: | |
- cron: '0 21 * * *' | |
jobs: | |
bot: | |
runs-on: ubuntu-latest | |
steps: | |
- name: 'Checkout codes' | |
uses: actions/checkout@v1 | |
- name: 'Get Weather' | |
run: bash ./weather.sh | |
- name: 'Get Date' | |
run: echo "::set-env name=REPORT_DATE::$(TZ=':Asia/Shenzhen' date '+%Y-%m-%d %T')" | |
- name: 'Send mail' | |
uses: dawidd6/action-send-mail@master | |
with: | |
server_address: smtp.163.com | |
server_port: 465 | |
username: ${{ secrets.MAIL_USERNAME }} | |
password: ${{ secrets.MAIL_PASSWORD }} | |
subject: Shenzhen Weather Report (${{env.REPORT_DATE}}) | |
body: file://result.html | |
to: [email protected] | |
from: GitHub Actions | |
content_type: text/html |