Dispath to production #305
This file contains hidden or 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: Dispath to production | |
on: | |
schedule: | |
# 每天凌晨 2 点(北京时间)运行 | |
- cron: "0 18 * * *" | |
workflow_dispatch: | |
# watch: | |
# types: started | |
jobs: | |
trigger: | |
runs-on: ubuntu-latest | |
# if: github.event.repository.owner.id == github.event.sender.id | |
steps: | |
- name: Extract sha | |
id: extract | |
shell: bash | |
run: | | |
echo "::set-output name=sha::$(sha=${{ github.sha }}; echo ${sha:0:6})" | |
- name: Repository Dispatch | |
uses: peter-evans/repository-dispatch@v1 | |
with: | |
token: ${{ secrets.DISPATCH_TOKEN }} | |
repository: merico-dev/website-docs | |
event-type: ${{ github.repository }}/${{ github.ref_name }}-${{ steps.extract.outputs.sha }} | |
client-payload: '{ "repo": "${{ github.repository }}", "ref": "${{ github.ref_name }}", "sha": "${{ github.sha }}", "env": "prod" }' | |
notify-feishu-on-failure: | |
runs-on: ubuntu-latest | |
needs: trigger | |
if: failure() | |
steps: | |
- name: Send notification to Feishu on failure | |
run: | | |
curl -X POST ${{ secrets.FEISHU_CI_BOT_WEBHOOK_URL }} \ | |
-H 'Content-Type: application/json' \ | |
-d '{ | |
"msg_type": "text", | |
"content": { | |
"text": "🚨 GitHub Action 失败通知:官网文档分发失败!\n- 仓库: ${{ github.repository }}\n- 分支: ${{ github.ref }}\n- 工作流: ${{ github.workflow }}\n- 触发人: ${{ github.actor }}\n- 查看日志: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" | |
} | |
}' |