Feature: Improve workflow trigger command and add get-workflow-run command#43755
Conversation
|
Thank you for your contribution. Your generosity and caring are unrivaled! Make sure to register your contribution by filling the Contribution Registration form, so our content wizard @kamalq97 will know the proposed changes are ready to be reviewed. |
🤖 AI-Powered Code Review AvailableHi @kamalq97, you can leverage AI-powered code review to assist with this PR! Available Commands:
|
There was a problem hiding this comment.
Pull request overview
This PR updates the GitHub integration’s workflow functionality by modernizing the github-trigger-workflow request headers and introducing a new command to retrieve workflow run details (github-get-workflow-run), including YAML output definitions and unit tests.
Changes:
- Update
github-trigger-workflowto send newer GitHub REST headers and attempt to return workflow run data. - Add
github-get-workflow-run/GitHub-get-workflow-runcommand to fetch a workflow run byrun_id. - Add test data + unit test coverage for the new command, and update the trigger-workflow test description.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| Packs/GitHub/Integrations/GitHub/GitHub.py | Updates trigger-workflow behavior/headers and adds the get-workflow-run command implementation + command registration. |
| Packs/GitHub/Integrations/GitHub/GitHub.yml | Adds output schemas for trigger-workflow and registers the new get-workflow-run command (deprecated + canonical). |
| Packs/GitHub/Integrations/GitHub/GitHub_test.py | Adds a unit test for get-workflow-run and updates the trigger-workflow test description. |
| Packs/GitHub/Integrations/GitHub/test_data/get_workflow_run_response.json | Adds a sample workflow-run JSON response for tests. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@marketplace-ai-reviewer start review |
|
🤖 Analysis started. Please wait for results... |
🤖 AI Review DisclaimerThis review was generated by an AI-powered tool and may contain inaccuracies. Please be advised, and we extend our sincere apologies for any inconvenience this may cause. |
marketplace-ai-reviewer
left a comment
There was a problem hiding this comment.
Hi! Thanks for your contribution to the GitHub integration. I've left a few notes on the PR, primarily regarding standardizing context output keys to PascalCase and fixing a typo in the API version headers. You'll also need to update a couple of outdated test assertions, add date format examples to the YAML descriptions, and remove an unnecessary deprecated command. Thanks again for your work!
@kamalq97, @copilot-pull-request-reviewer[bot] please review and approve the results generated by the AI Reviewer by responding 👍 on this comment.
| response = http_request("POST", url_suffix=suffix, headers=headers, data=data) | ||
| return_results(CommandResults( | ||
| outputs_prefix="GitHub.WorkflowRun", | ||
| outputs_key_field="workflow_run_id", |
There was a problem hiding this comment.
Inconsistent outputs_key_field for GitHub.WorkflowRun
There was a problem hiding this comment.
The outputs_key_field for GitHub.WorkflowRun is still inconsistent. In github_trigger_workflow_command it is set to WorkflowRunID, while in github_get_workflow_run_command it is set to ID. To ensure the context data is merged correctly, both commands should use the exact same key field (e.g., both should use ID or both should use WorkflowRunID).
* Reformatted the return statement in `github_trigger_workflow_command` for better clarity. * Removed unused import `github_get_workflow_run_command` from the test file.
…ts' into feature/github-workfow-runs-improvements
|
@kamalq97 hello how are you? For us, it is no longer viable to contribute to the community if implementing an improvement takes so long, we have developments pending ... |
|
Hi @jesusgpo Thank you once again for your contribution. The PR has been assigned to member of the team for review. Please note that the team currently has a large number of contributions to review. New contributions may experience a slight delay while we work on clearing the backlog. Thank you for the patience and we hope you can remain a valuable member of our community. |
|
🤖 Analysis started. Please wait for results... |
|
Hi @jesusgpo, since the GitHub integration was recently updated, please make sure to update your forked repo and branch. |
🤖 AI Review DisclaimerThis review was generated by an AI-powered tool and may contain inaccuracies. Please be advised, and we extend our sincere apologies for any inconvenience this may cause. |
marketplace-ai-reviewer
left a comment
There was a problem hiding this comment.
🔄 Re-reviewing updates...
Important
To maintain review integrity, threads marked as Resolved without accompanying changes or explanations will be automatically unresolved for further verification.
Thanks for your contribution to the GitHub pack! I've reviewed the PR and found a few adjustments needed, specifically around verifying the GitHub API version headers and adding the missing deprecated command mapping. Please also ensure the outputs_key_field is consistent (updating tests if needed), add the vendor name to the metadata keywords, and use approved prefixes in your release notes. Let me know if you have any questions!
Additionally, please address the following file-level notes:
Packs/GitHub/Integrations/GitHub/GitHub.py: Invalid GitHub API version in headersPacks/GitHub/pack_metadata.json: The vendor name must appear in thekeywordsfield.
@barryyosi-panw, @marketplace-ai-reviewer, @copilot-pull-request-reviewer[bot], @jesusgpo please review and approve the results generated by the AI Reviewer by responding 👍 on this comment.
|
|
||
| suffix = f"/repos/{owner}/{repository}/actions/workflows/{workflow}/dispatches" | ||
| headers = {"Authorization": f"Bearer {TOKEN}", "Accept": "application/vnd.github.v3+json"} | ||
| headers = {"Authorization": f"Bearer {TOKEN}", "Accept": "application/vnd.github+json", "X-GitHub-Api-Version": "2026-03-10"} |
There was a problem hiding this comment.
Verify the X-GitHub-Api-Version header value
| # http_request returns a dict for 200 (JSON body) and a Response object for 204 No Content. | ||
| if isinstance(response, dict): | ||
| outputs = { | ||
| "WorkflowRunID": response.get("workflow_run_id") or response.get("id"), |
There was a problem hiding this comment.
Inconsistent outputs_key_field for GitHub.WorkflowRun
| mocker_results.assert_called_once() | ||
| result: CommandResults = mocker_results.call_args[0][0] | ||
| assert result.outputs_prefix == "GitHub.WorkflowRun" | ||
| assert result.outputs["WorkflowRunID"] == 9876 |
There was a problem hiding this comment.
Update test assertion if WorkflowRunID is changed to ID
|
|
||
| ##### GitHub | ||
|
|
||
| - Updated command **_github-trigger-workflow_** to support workflow runs that return a JSON body (HTTP 200), in addition to the standard 204 No Content response. When run details are returned, they are stored in the `GitHub.WorkflowRun` context with the following fields: `WorkflowRunID`, `RunUrl`, and `HtmlUrl`. |
There was a problem hiding this comment.
The release note entry does not start with an approved prefix. Please use an approved prefix such as Updated the.
| ##### GitHub | ||
|
|
||
| - Updated command **_github-trigger-workflow_** to support workflow runs that return a JSON body (HTTP 200), in addition to the standard 204 No Content response. When run details are returned, they are stored in the `GitHub.WorkflowRun` context with the following fields: `WorkflowRunID`, `RunUrl`, and `HtmlUrl`. | ||
| - Added new command **_github-get-workflow-run_** to retrieve details of a specific workflow run by its ID. Outputs are stored in `GitHub.WorkflowRun` with fields: `ID`, `Name`, `HeadBranch`, `HeadSha`, `DisplayTitle`, `RunNumber`, `Event`, `Status`, `Conclusion`, `WorkflowID`, `CreatedAt`, `UpdatedAt`, `Url`, and `HtmlUrl`. |
There was a problem hiding this comment.
The release note entry does not start with an approved prefix. Please use an approved prefix such as Added the.
Contributing to Cortex XSOAR Content
Make sure to register your contribution by filling the contribution registration form
The Pull Request will be reviewed only after the contribution registration form is filled.
Status
Description
This PR improves the GitHub integration by updating the
github-trigger-workflowcommand to use the latest GitHub REST API specification and adding a newgithub-get-workflow-runcommand.github-trigger-workflowcommandAcceptheader fromapplication/vnd.github.v3+jsontoapplication/vnd.github+jsonand addedX-GitHub-Api-Version: 2026-03-10to align with the current GitHub REST API versioning.200response with the workflow run details. The command now returns aCommandResultsobject withoutputs_prefix="GitHub.WorkflowRun"containing the triggered run data.workflow_run_id,run_url,html_url.New
github-get-workflow-runcommandrun_id.CommandResultsobject withoutputs_prefix="GitHub.WorkflowRun"and outputs:id,name,head_branch,head_sha,display_title,run_number,event,status,conclusion,workflow_id,url,html_url,created_at,updated_at.GitHub-get-workflow-run) and current (github-get-workflow-run) command sections of the YAML manifest.Must have
relates: https://jira-dc.paloaltonetworks.com/browse/CIAC-16455