Trigger GitHub Action on the specified branch and get the run ID.
(branch, action)
| 35 | |
| 36 | |
| 37 | def trigger_github_action(branch, action): |
| 38 | """Trigger GitHub Action on the specified branch and get the run ID.""" |
| 39 | result = subprocess.run( |
| 40 | ["gh", "workflow", "run", f"{action}.yml", "--ref", branch], |
| 41 | capture_output=True, text=True |
| 42 | ) |
| 43 | if result.returncode != 0: |
| 44 | print(f"Could not trigger GitHub Action for branch: {branch}") |
| 45 | print(result.stderr) |
| 46 | sys.exit(1) |
| 47 | print(f"To view the status, run: `gh run list` and `gh run view <run-id>`") |
| 48 | |
| 49 | |
| 50 | def parse_args(): |