fpgmaas/cookiecutter-poetry

Should locally defined actions be moved from `.github/workflows/` to `.github/actions/`?

Closed this issue ยท 1 comments

Hi there! ๐Ÿ‘‹

I'm the maintainer of check-jsonschema, and a user recently reported the hooks failing on a project generated from this template: python-jsonschema/check-jsonschema#113

I see that there are actions defined in this repo in the workflows dir, which is what was confusing the pre-commit hook.
The hook behavior is to check any YAML files in .github/workflows/ against the workflow schema from schemastore. I'm not confident that the logic is correct, but it is consistent with the match rule in schemastore today.

By my reading of GitHub Workflows docs -- and the observed behavior of the service -- workflows are defined as .github/workflows/*.ya?ml, not .github/workflows/**/*.ya?ml. So I think there's a case to be made that check-jsonschema is not accurately describing github's behavior, but I'm continuing to study the situation a bit before making changes.

Schemastore defines a schema for github-actions, and check-jsonschema provides a hook. In the former case, it matches action.ya?ml in the repo root dir, and in the latter it matches action.ya?ml in the repo root or .github/actions/**/*.ya?ml. The rationale here is that GitHub's docs show use of that directory for local actions, so it seems somewhat common. Supporting validation of more local actions is therefore reasonable down this path.

It would therefore be nice, from my perspective, to move action definitions from subdirs of ./github/workflows to subdirs of ./github/actions/. The hooks would then run correctly without adjustments to check-jsonschema. Even if I make the workflow matching more strict (I probably will, but am taking time to think about it), actions won't be checked outside of the .github/actions/ dir.

Hi @sirosen, thanks for opening this issue. I think the proposed change makes sense. Since I am currently on holiday, I will investigate the issue further (and probably implement your proposed change) in a week or two from now. Sorry for the small delay.