reusable workflows, actions, local references and branching #66094
Replies: 3 comments 12 replies
-
This seem like a common use case and it's not explained in the official documentation. |
Beta Was this translation helpful? Give feedback.
-
When calling a reusable workflow, the repo isn't The reason you get this error is that it's expecting a local action (as in, local to the CALLING repo not the REUSABLE WORKFLOW repo)
As far as I know, you either have to hardcode the branch name in the reusable workflow or somehow dynamically clone the reusable workflow repo and have the actions placed in the appropriate subdirectory it's expecting. Updating the branch names can be a chore, especially if you have multiple, but some folks have created linting/parsing scripts to make sure the branch names all match before allowing a merge. |
Beta Was this translation helpful? Give feedback.
-
🕒 Discussion Activity Reminder 🕒 This Discussion has been labeled as dormant by an automated system for having no activity in the last 60 days. Please consider one the following actions: 1️⃣ Close as Out of Date: If the topic is no longer relevant, close the Discussion as 2️⃣ Provide More Information: Share additional details or context — or let the community know if you've found a solution on your own. 3️⃣ Mark a Reply as Answer: If your question has been answered by a reply, mark the most helpful reply as the solution. Note: This dormant notification will only apply to Discussions with the Thank you for helping bring this Discussion to a resolution! 💬 |
Beta Was this translation helpful? Give feedback.
-
Select Topic Area
Question
Body
I'm trying to set up a a bunch of reusable workflows and custom actions that will be reused by many other repositories. But I'm having some trouble with referencing things.
I try to give a simplified picture below. In my repository (lets call it
example/actionflow
) I have:.github/actions/action1/
(withaction.yml
andindex.js
).github/actions/action2/
(withaction.yml
andindex.js
).github/workflows/all.yml
.github/workflows/flow1.yml
.github/workflows/flow2.yml
So far so good. In a different repository (
example/actiontest
) I have the following:As you can see, I'm currently using the devel branch of the
actionflow
repo. I will continue working on it, while others might already use the stablemain
branch. Because of this, I want to avoid hardcoding any branch names in the workflows above, because that makes merging a pain.So far this works fine for the workflows, by using relative paths in
all.yml
Above will run fine within the
example/actiontest
repo.However where it breaks apart is when we add an action to one of the flows.
Running this within the
example/actiontest
repo will result in the following error:So while the earlier, when using only workflows, the
./.github/
path correctly referenced the directory in theexample/actionflow
repository, the calls to actions now reference theexample/actiontest
repository and can no longer find the actions I want to use.Of course I could always use a line like
uses: example/actionflow/.github/actions/action1@devel
, but that would hardcode the branch name.So here's the question: how do I reference actions relative to the workflow file they are called from?
Beta Was this translation helpful? Give feedback.
All reactions