-
-
Save KyMidd/27e12ec6b0159620ab638dadcc762b16 to your computer and use it in GitHub Desktop.
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
| def start_repo_cop_targeted(repo_name, PAT): | |
| (part 2) | |
| # The API endpoint to communicate with | |
| url_post = "https://api.github.com/repos/{org_name}/{repo_name}/actions/workflows/{yaml_actions_file_name}.yml/dispatches" | |
| # A POST request to tthe API | |
| try: | |
| post_response = requests.post( | |
| url_post, | |
| headers=post_headers, | |
| json=payload | |
| ) | |
| except ClientError as e: | |
| raise e | |
| if post_response.status_code != 204: | |
| print("🚨 Error: ", post_response.status_code) | |
| print(post_response.text) | |
| sys.exit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment