Skip to content

Instantly share code, notes, and snippets.

@KyMidd
Last active May 3, 2023 01:47
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