@@ -55,13 +55,17 @@ def make_cfapi_request(
5555 * ,
5656 api_key : str | None = None ,
5757 suppress_errors : bool = False ,
58+ params : dict [str , Any ] | None = None ,
5859) -> Response :
5960 """Make an HTTP request using the specified method, URL, headers, and JSON payload.
6061
6162 :param endpoint: The endpoint URL to send the request to.
6263 :param method: The HTTP method to use ('GET', 'POST', etc.).
6364 :param payload: Optional JSON payload to include in the POST request body.
65+ :param extra_headers: Optional extra headers to include in the request.
66+ :param api_key: Optional API key to use for authentication.
6467 :param suppress_errors: If True, suppress error logging for HTTP errors.
68+ :param params: Optional query parameters for GET requests.
6569 :return: The response object from the API.
6670 """
6771 url = f"{ get_cfapi_base_urls ().cfapi_base_url } /cfapi{ endpoint } "
@@ -75,7 +79,7 @@ def make_cfapi_request(
7579 cfapi_headers ["Content-Type" ] = "application/json"
7680 response = requests .post (url , data = json_payload , headers = cfapi_headers , timeout = 60 )
7781 else :
78- response = requests .get (url , headers = cfapi_headers , timeout = 60 )
82+ response = requests .get (url , headers = cfapi_headers , params = params , timeout = 60 )
7983 response .raise_for_status ()
8084 return response # noqa: TRY300
8185 except requests .exceptions .HTTPError :
@@ -239,6 +243,20 @@ def create_pr(
239243 return make_cfapi_request (endpoint = "/create-pr" , method = "POST" , payload = payload )
240244
241245
246+ def setup_github_actions (owner : str , repo : str , base_branch : str , workflow_content : str ) -> Response :
247+ """Set up GitHub Actions workflow by creating a PR with the workflow file.
248+
249+ :param owner: Repository owner (username or organization)
250+ :param repo: Repository name
251+ :param base_branch: Base branch to create PR against (e.g., "main", "master")
252+ :param workflow_content: Content of the GitHub Actions workflow file (YAML)
253+ :return: Response object with pr_url and pr_number on success
254+ """
255+ payload = {"owner" : owner , "repo" : repo , "baseBranch" : base_branch , "workflowContent" : workflow_content }
256+
257+ return make_cfapi_request (endpoint = "/setup-github-actions" , method = "POST" , payload = payload )
258+
259+
242260def create_staging (
243261 original_code : dict [Path , str ],
244262 new_code : dict [Path , str ],
0 commit comments