:calls: `POST /repos/{owner}/{repo}/actions/workflows/{workflow_id}/dispatches `_ Note: raises or return False without details on error, depending on the ``throw`` parameter.
(
self,
ref: github.Branch.Branch | github.Tag.Tag | github.Commit.Commit | str,
inputs: Opt[dict] = NotSet,
throw: bool = False,
)
| 145 | |
| 146 | # v3: default throw to True |
| 147 | def create_dispatch( |
| 148 | self, |
| 149 | ref: github.Branch.Branch | github.Tag.Tag | github.Commit.Commit | str, |
| 150 | inputs: Opt[dict] = NotSet, |
| 151 | throw: bool = False, |
| 152 | ) -> bool: |
| 153 | """ |
| 154 | :calls: `POST /repos/{owner}/{repo}/actions/workflows/{workflow_id}/dispatches <https://docs.github.com/en/rest/reference/actions#create-a-workflow-dispatch-event>`_ |
| 155 | Note: raises or return False without details on error, depending on the ``throw`` parameter. |
| 156 | """ |
| 157 | assert ( |
| 158 | isinstance(ref, github.Branch.Branch) |
| 159 | or isinstance(ref, github.Tag.Tag) |
| 160 | or isinstance(ref, github.Commit.Commit) |
| 161 | or isinstance(ref, str) |
| 162 | ), ref |
| 163 | assert inputs is NotSet or isinstance(inputs, dict), inputs |
| 164 | if isinstance(ref, github.Branch.Branch): |
| 165 | ref = ref.name |
| 166 | elif isinstance(ref, github.Commit.Commit): |
| 167 | ref = ref.sha |
| 168 | elif isinstance(ref, github.Tag.Tag): |
| 169 | ref = ref.name |
| 170 | if inputs is NotSet: |
| 171 | inputs = {} |
| 172 | url = f"{self.url}/dispatches" |
| 173 | input = {"ref": ref, "inputs": inputs} |
| 174 | |
| 175 | if throw: |
| 176 | self._requester.requestJsonAndCheck("POST", url, input=input) |
| 177 | return True |
| 178 | else: |
| 179 | status, _, _ = self._requester.requestJson("POST", url, input=input) |
| 180 | return status == 204 |
| 181 | |
| 182 | def get_runs( |
| 183 | self, |
no test coverage detected