github / vscode-github-actions

GitHub Actions extension for VS Code
https://marketplace.visualstudio.com/items?itemName=GitHub.vscode-github-actions
MIT License
469 stars 70 forks source link

Actions in different directory than .github\workflows #325

Open bvandevliet opened 2 months ago

bvandevliet commented 2 months ago

Discussed in https://github.com/github/vscode-github-actions/discussions/207

Originally posted by **MariuszMielcarski** June 1, 2023 Hi I have noticed that the plugin successfully found my workflows in .github\workflows directory - and that works great. But I have some reusable actions defined in other directory, and it was not identified as GitHub actions by the plugin. Can configure the plugin somehow to add additional directories to track? To have IntelliSense work for my custom actions too.

Wanted to make this an issue as it would also really help out for people like me that run a simple self-hosted Gitea instance, since these workflows are stored in .gitea/workflows. If only there is some setting for the extension that holds an array of workflow paths would be really awesome! Default value would then of course be [".github/workflows"] :)

felipesu19 commented 1 month ago

That would be great! Right now this isn't planned, but if someone added it in a PR, I would review it.

keattang commented 4 days ago

@felipesu19 are you able to point me in the direction for how and where I might implement this? It would be very useful for us as we are creating reusable workflows instead of actions in order to get the linting but are finding this is creating a lot of clutter when we look at our workflows in the UI

felipesu19 commented 3 days ago

@felipesu19 are you able to point me in the direction for how and where I might implement this? It would be very useful for us as we are creating reusable workflows instead of actions in order to get the linting but are finding this is creating a lot of clutter when we look at our workflows in the UI

I am pretty sure the logic is based on this regex: https://github.com/github/vscode-github-actions/blob/0b6131d600a40099d0a96103b2296e4f9cb4cc69/src/workflow/documentSelector.ts#L2 I think if you track down where documentSelector is used, you could inject a new regex or just modify the selector.

(Caveat: I have not looked at this in any depth, this is my initial "taking a look at it" impression)

keattang commented 3 days ago

Thanks @felipesu19!

Looking into this further, it seems that the languageservice only knows how to lint workflows and not custom actions. Is this correct? Do you know of a way we can lint custom actions (i.e. action.yaml)?