Create a workflow dispatch event to trigger the pr to be evaluated for mergeability.
(inputs: WorkflowInputs)
| 102 | |
| 103 | /** Create a workflow dispatch event to trigger the pr to be evaluated for mergeability. */ |
| 104 | async function createWorkflowForPullRequest(inputs: WorkflowInputs) { |
| 105 | /** An instance of the octokit Github client. */ |
| 106 | const githubClient = await github(); |
| 107 | |
| 108 | // When a sha is provided we set the status on sha to note that mergeability check is about to start. |
| 109 | if (inputs.sha !== undefined) { |
| 110 | await githubClient.repos.createCommitStatus({ |
| 111 | repo: inputs.repo, |
| 112 | owner: inputs.owner, |
| 113 | state: 'pending', |
| 114 | description: 'Mergibility check requested', |
| 115 | sha: inputs.sha, |
| 116 | context: 'mergeability', |
| 117 | }); |
| 118 | } |
| 119 | |
| 120 | console.info(`Requesting workflow run for: ${JSON.stringify(inputs)}`); |
| 121 | await githubClient.actions.createWorkflowDispatch({ |
| 122 | owner: 'angular', |
| 123 | repo: 'dev-infra', |
| 124 | ref: 'main', |
| 125 | workflow_id: 'branch-manager.yml', |
| 126 | inputs, |
| 127 | }); |
| 128 | } |
| 129 | |
| 130 | /** The Octokit instance, if defined to allow token revocation after the action executes. */ |
| 131 | let _github: Octokit | null = null; |