Reusable workflow: workflow is invalid: `workflows` cannot be empty

While trying to use reusable workflows I ended up with a very confusing error that makes little sense.

Invalid workflow file : .github/workflows/release.yml#L1
handling usage of workflow "ansible-community/ansible-compat/.github/workflows/tox.yml@main": workflow is invalid: `workflows` cannot be empty

This happened on chore: remove unaccepted keyworkd for reused workflows (#86) · ansible-community/ansible-compat@2fda08d · GitHub and the logic is quite simple: a release workflow that is reusing two other workflows, the testing one and the release body itself.

As seen at ansible-compat/release.yml at 2fda08dc9f61f1a945607d0da695fc7df4298d83 · ansible-community/ansible-compat · GitHub that is only a chain of two reused workflows.

I am ware that the current beta does not allow nesting reusable workflows, but that is not nesting at all as they are called one after another.

What is wrong? Did I find a bug?

1 Like

Hi - I’m the product manager for reusable workflows. Thanks for reporting this. There’s two things I see:

  • Your reusable workflow needs to listen to workflow_call. I see that you added workflow_run instead. Try swapping that to call, and that should get you past this issue
  • That error message is super unhelpful. I’ve filed an internal issue for us to improve that
1 Like

Thanks for pointing the error about incorrect use of workflow_run, I fixed it. Still, doing this did not fix the release workflow and I can still the same error. Take a look at Actions · ansible-community/ansible-compat · GitHub

As you can see the latest run is at chore: fix mistake in tox workflow · ansible-community/ansible-compat@be06b7f · GitHub and that still presents the same error. That commit was merged before the release event, so tox.yml@main was expected to be already fixed.

Any further hints would be greatly appreciated.

PS. Once I get them working I will try to propose an improvement to the JSON workflows schema, which currently is clueless around reusable workflows. That should also help others write valid workflows.

Another annoying issue with workflows is related to how they are displayed in the UI of github, with forced breadcrumbs which can confuse the user.

Is there a way to disable the breakcrumbs on check names and display only their simple name. The fully qualified name could be displayed as a title (hover).

If you see the first one has 3 sections because is a reusable workflow run, making it even worse than the 2 sectioned normal runs.

Is there a way to make the workflow name disappear from the list? As we add more workflows we can easily went out of genuine names for those prefixes.

I see in your run today that this is fixed. Here’s what happened:

The failed run that you see is associated with the push event, and specifically the push in your ssbarnea-patch-2 branch. Note that while this branch contained the fix, the release workflow is referencing the reusable workflow in main. The main branch didn’t have the fix yet.

Later you merged the fix. Actions went ahead and parsed the workflow files at that point, and if there had been an error, it would have created a new run and shown it to you. Since there were no errors, and your workflow is supposed to execute when releases are created, Actions didn’t create a run. That’s why you see a run associated with the push in the branch, and none associated with the push to main - we’re trying to surface errors early.

Today, you created the release, which triggered your run. Since the fix was merged into main at that point, it works :tada:

1 Like

Is there a way to make the workflow name disappear from the list? As we add more workflows we can easily went out of genuine names for those prefixes.

Not today, but I appreciate the feedback


I was hopping that there was a trick that we could use like setting workflow name or job name to empty string, null or something similar in order to collapse the computed full name shorter.