Home >Development Tools >git >how to run github actions workflow manually

how to run github actions workflow manually

Mary-Kate Olsen
Mary-Kate OlsenOriginal
2024-10-09 16:01:16656browse

How to trigger GitHub Actions workflows manually from the UI?

To manually trigger a GitHub Actions workflow from the UI, follow these steps:

  1. Navigate to the repository that contains the workflow you want to trigger.
  2. Click on the "Actions" tab.
  3. Find the workflow you want to trigger and click on the "Run workflow" button.

Can I execute GitHub Actions workflows manually via the command line?

Yes, you can execute GitHub Actions workflows manually via the command line using the gh CLI. To do this, run the following command:

<code>gh workflow run <workflow-name></code>

Replace <workflow-name> with the name of the workflow you want to trigger.

How to initiate GitHub Actions workflows on demand using the API?

To initiate GitHub Actions workflows on demand using the API, you can use the POST /repos/{owner}/{repo}/actions/workflows/{workflow_id}/dispatches endpoint. This endpoint requires authentication via an OAuth token with the workflows scope.

Here is an example request body:

<code class="JSON">{
  "ref": "refs/heads/main",
  "inputs": {
    "example_input": "my_input_value"
  }
}</code>

Replace {owner} with the owner of the repository, {repo} with the name of the repository, and {workflow_id} with the ID of the workflow you want to trigger.

The above is the detailed content of how to run github actions workflow manually. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn