Created
January 30, 2025 06:21
-
-
Save garywill/8cfcbda62197c145e100079fce334d3c to your computer and use it in GitHub Desktop.
Manually trigget Github Action (CI) workflow by shell CLI (bash). 用shell手动触发一个Github Action上的workflow开始运行
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # https://docs.github.com/zh/rest/actions/workflows#create-a-workflow-dispatch-event | |
| echo -n "Enter GitHub token: " | |
| # Disable echo. | |
| stty -echo | |
| read token | |
| # Enable echo. | |
| stty echo | |
| echo | |
| username= | |
| repo= | |
| workflow_id= | |
| ci_branch= | |
| curl -L \ | |
| -X POST \ | |
| -H "Accept: application/vnd.github+json" \ | |
| -H "Authorization: Bearer $token" \ | |
| -H "X-GitHub-Api-Version: 2022-11-28" \ | |
| https://api.github.com/repos/$username/$repo/actions/workflows/$workflow_id/dispatches \ | |
| -d '{"ref":"'"$ci_branch"'"}' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment