From de4f25c13d25f1259ab1bd6afa6ad7865dfe7fe3 Mon Sep 17 00:00:00 2001 From: Dawid Dziurla Date: Thu, 9 Jul 2020 12:50:09 +0200 Subject: [PATCH] utils/github: add workflow_dispatch_event method --- Library/Homebrew/utils/github.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Library/Homebrew/utils/github.rb b/Library/Homebrew/utils/github.rb index 4ac886a188..7b38f33ce8 100644 --- a/Library/Homebrew/utils/github.rb +++ b/Library/Homebrew/utils/github.rb @@ -450,6 +450,13 @@ module GitHub scopes: CREATE_ISSUE_FORK_OR_PR_SCOPES) end + def workflow_dispatch_event(user, repo, workflow, ref, **inputs) + url = "#{API_URL}/repos/#{user}/#{repo}/actions/workflows/#{workflow}/dispatches" + open_api(url, data: { ref: ref, inputs: inputs }, + request_method: :POST, + scopes: CREATE_ISSUE_FORK_OR_PR_SCOPES) + end + def get_artifact_url(user, repo, pr, workflow_id: "tests.yml", artifact_name: "bottles") scopes = CREATE_ISSUE_FORK_OR_PR_SCOPES base_url = "#{API_URL}/repos/#{user}/#{repo}"