簡體   English   中英

Github Actions 中的 repository_dispatch 和 workflow_dispatch 有什么區別?

[英]Whats is the difference between repository_dispatch and workflow_dispatch in Github Actions?

請用一些現實世界的例子解釋這兩個事件觸發器之間的區別。

顯然, repository_dispatch事件只能在默認分支上讀取

看:

對於后者,來自William Villeneuve

# TODO: replace :token, :user, and :repo
curl -H "Authorization: token :token" \
    -H 'Accept: application/vnd.github.everest-preview+json' \
    "https://api.github.com/repos/:user/:repo/dispatches" \
    -d '{"event_type": "awesomeness", "client_payload": {"foo": "bar"}}'
name: example-client-payload-action
on: repository_dispatch
jobs:
  test:
    name: Test
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v1
      - run: 'echo "field: ${{ github.event.client_payload.foo }}"'
      - run: 'echo "payload: ${{ toJson(github.event.client_payload) }}"'
      - run: echo baz
        if: github.event.action == 'baz'

如此處所示

只是在這里發布,因為它似乎沒有記錄 - 您還可以指定要觸發的類型列表:

on:
  repository_dispatch:
    types:
      - manual-trigger-mytest
      - manual-trigger-all

來自“ 手動觸發 GitHub 操作工作流

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM