Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add support for running an Actions workflow#269

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
joshmgross wants to merge6 commits intogithub:main
base:main
Choose a base branch
Loading
fromjoshmgross:joshmgross/run-workflow

Conversation

joshmgross
Copy link
Member

@joshmgrossjoshmgross commentedApr 14, 2025
edited
Loading

Supports#268

This adds a tool to allow running an Actions workflow via theworkflow_dispatch API.

Demo

CleanShot.2025-04-14.at.15.57.51.mp4

(Tested using these changes built from source per theinstructions)

MCP Triggered Run

https://github.com/joshmgross/actions-testing/actions/runs/14454560690/job/40534749404

barradam, shessenauer, robherley, zaataylor, naofumi-fujii, minhthong582000, kevinmingtarja, and AH-Merii reacted with rocket emoji
@@ -0,0 +1,99 @@
package github
Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

There are alot of Actions APIs, I suspect the single-file per API area will break down at some point.

I tried defining a separateactions package, but it created some circular dependencies with thisgithub package.
I'd be happy to explore that more, but I wanted to keep these changes focused on this tool.

SamMorrowDrums reacted with thumbs up emoji
Copy link
Collaborator

@SamMorrowDrumsSamMorrowDrumsApr 15, 2025
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Appreciate you mentioning though, it's same reason I didn't consider new packages for tools yet.

Pretty sure the helpers and server can be extracted to their own packages to avoid this.

CC@williammartin@juruen

Copy link
Collaborator

@juruenjuruenApr 15, 2025
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

There are alot of Actions APIs, I suspect the single-file per API area will break down at some point.

I tried defining a separateactions package, but it created some circular dependencies with thisgithub package.

This might open an interesting debate that really resonates with me!

When I started writing Go, I came from other languages where quickly deciding to use packages was the norm. So I followed suit, and my initial reaction was to do the same. However, over time, I've come to terms with the fact that this might not be entirely idiomatic.

Takego-github, for example — they implement almost the entire GitHub API withina single package.

So my point here is that maybe we don't need to introduce more packages right away. We might consider another alternative, such as splitting the functionality into files likeactions_foo.go,actions_bar.go, etc., and that might be more idiomatic.

Having said that, I don't have a strong opinion on it, but I'd like us to consider the above before we make the decision.

Thanks! ❤️

joshmgross reacted with thumbs up emoji
Comment on lines 56 to 68
// Get the optional inputs parameter
var inputs map[string]any
if inputsObj, exists := request.Params.Arguments["inputs"]; exists && inputsObj != nil {
inputs, _ = inputsObj.(map[string]any)
}

// Convert inputs to the format expected by the GitHub API
inputsMap := make(map[string]any)
if inputs != nil {
for k, v := range inputs {
inputsMap[k] = v
}
}
Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

This was mostly generated by Copilot, not sure if there's a better way to process an object parameter.

@joshmgrossjoshmgross marked this pull request as ready for reviewApril 14, 2025 20:03
),
mcp.WithString("repo",
mcp.Required(),
mcp.Description("Repository name"),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

No mention of case-sensitivity here. Does that imply that it is case-sensitive? Should we be explicit?

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

This matches the description used by most/all of the otherrepo MCP inputs in this repo, so I stuck to being consistent with them.

I was thinking it might make sense to define some constant/reusable input definitions for these common inputs like repo & owner for consistency.

),
mcp.WithString("workflowId",
mcp.Required(),
mcp.Description("The ID of the workflow. You can also pass the workflow file name as a string."),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Just the workflow file name itself is acceptable? Or the relative path to the workflow file?

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

The API supports both

Relative path

gh api -X POST /repos/joshmgross/actions-testing/actions/workflows/hello-world.yaml/dispatches -f"ref=main"

Full path (note the/ must be escaped)

gh api -X POST /repos/joshmgross/actions-testing/actions/workflows/.github%2Fworkflows%2Fhello-world.yaml/dispatches -f"ref=main"

I don't thinkgithub/go-github will escape the/ by default though, so we might need to handle that 🤔

func (s*ActionsService)CreateWorkflowDispatchEventByFileName(ctx context.Context,owner,repo,workflowFileNamestring,eventCreateWorkflowDispatchEventRequest) (*Response,error) {u:=fmt.Sprintf("repos/%v/%v/actions/workflows/%v/dispatches",owner,repo,workflowFileName)returns.createWorkflowDispatchEvent(ctx,u,&event)}

https://github.com/google/go-github/blob/6f8bceff0b000e6c8f5a3e60922ca57188de264e/github/actions_workflows.go#L170-L179

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I'd be tempted to flip this around too, and call itworkflow_file or something, as it has file access already it can probably work out what workflows it can provide. The ID is only useful where it has received it from a list, and the list endpoint can probably return the file location as part of the list, which is also more useful than the ID, in terms of editing the file.

Does that make sense? The goal here is to make an API that LLMs comprehend and use natively, so definitely have a think on this.

shessenauer reacted with thumbs up emoji
Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Renamed toworkflow_file -034621b

@@ -82,6 +86,7 @@ func InitToolsets(passedToolsets []string, readOnly bool, getClient GetClientFn,
tsg.AddToolset(users)
tsg.AddToolset(pullRequests)
tsg.AddToolset(codeSecurity)
tsg.AddToolset(actions)
Copy link
MemberAuthor

@joshmgrossjoshmgrossApr 15, 2025
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

@SamMorrowDrums let me know if I added this correctly

Looking through#188, it seems like we don't want some toolsets enabled by default but it's not clear to me what enables that.

Default Enabled Features
By default, the following features are enabled:
...

As far as I can tell, the default is "all"

varDefaultTools= []string{"all"}

@joshmgrossjoshmgross requested a review froma team as acode ownerApril 23, 2025 17:21
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@jww3jww3jww3 left review comments

@juruenjuruenAwaiting requested review from juruen

@SamMorrowDrumsSamMorrowDrumsAwaiting requested review from SamMorrowDrums

@williammartinwilliammartinAwaiting requested review from williammartin

@tobytobyAwaiting requested review from toby

At least 1 approving review is required to merge this pull request.

Assignees
No one assigned
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

4 participants
@joshmgross@juruen@SamMorrowDrums@jww3

[8]ページ先頭

©2009-2025 Movatter.jp