Hey @jenschelkopf it seem you are everywhere thanks a lot for your help and your update here. My 2 cents on this if it helps cut scope, I think the main use-case I had in mind was that of referencing the current branch, as that way I can include in a PR a workflow that uses reusable workflows created or updated on the PR itself.
I am asking because this new feature is really great and we adopted it immediately, but in case work on the workflows is done on a feature branch, now you’d have to change the refs during the development and change them back at PR, which is very error prone and creates unnecessary overhead.
The local reference scenario that @pecigonzalo mentioned is what we’re focused on initially. I think that covers 90% of folks who are requesting this. It will likely look a lot like referencing a local action, but without the need to do a checkout first: Workflow syntax for GitHub Actions - GitHub Docs
I’m not sure I understand your entire scenario, but here’s some notes about reusable vs composite actions:
You can reference a composite action with a local path today (not yet supported with reusable)
Composite actions must be defined in an action.yml, so if you want multiple in a single repository, you’ll need to organize them into folders. You can name reusable workflows whatever you want
Reusable workflows show up in the Actions tab, and composite actions do not
You can directly execute a reusable workflow in addition to making it callable. Composite actions are only executed when they are called
Both composite actions and reusable workflows execute in the caller’s context, so both have access to environments and secrets (as long as they are provided in the caller’s workflow file)
Composite actions are one or more steps, while reusable workflows are one or more jobs. That means reusable workflows can execute things on different runners, have more complicated logic like fan-in and fan-on patterns, and give you a “clean” runner
The exact scenario here is reusing a job or steps (like a deployment, migration, etc) from multiple action definitions.
eg. An automated deployment on commit and a user manually triggering a deployment.
While we can set multiple triggers for a workflow, sometimes that makes it more complicated as I have to cater to calls with input and with just commit/push/etc context.
Without this feature, there doesn’t seem to be a way to have workflows depend on other workflows such that checks passing on pull requests guarantees checks passing on main branch after pull request merge.
It is not safe to develop on reusable workflows as caller workflows (depending on main branch) will not be validated against the dev branch reusable workflow.
Since this seems to be a major limitation it should probably be noted (maybe top of the list) in the reusable workflow documentation: Reusing workflows - GitHub Docs
Hey everyone - I’m the product manager for reusable workflows. We’re currently working on the local reference scenario. It should be available in the next couple of weeks.
Here’s how it will work:
If a reusable workflow is located in the same repository as the caller, you can reference it with a local path: {path}/{filename}. We’ll automatically use the current ref.
Here’s an example that shows the two ways you’ll have to reference a reusable workflow: