action.yml 核心代码为: - name: 'Checkout codes' uses: actions/checkout@v1 - name: "触发garden的GithubAction" run: bash ./garden.sh 下面是完整代码: name: 'GitHub Actions Weather Bot' on: push: workflow_dispatch: 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 "REPORT_DATE=$(TZ=':Asia/Shanghai' date '+%Y-%m-%d %T')" >> $GITHUB_ENV - 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: Shanghai Weather Report (${{env.REPORT_DATE}}) html_body: file://result.html to: yifeng.ruan@gmail.com from: GitHub Actions weather.sh #!/bin/sh set -eux CITY=Shanghai LANGUAGE="zh-CN" UNIT=m UA="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36" curl \ -H "Accept-Language: $LANGUAGE" \ -H "User-Agent: $UA" \ -o result.html \ https://wttr.in/$CITY?format=4\&$UNIT JS 脚本