Reputation: 3610
I'm following the examples of a docker Github action to create my own action. I would like to keep the action in a private repository in my organization, and then re-use it from another repositories under the same organization.
The documentation states that "When an action is in a private repository, the action can only be used in workflows in the same repository" but, to my understanding, it doesn't cover how such actions behave in organization context - only in standalone repo context. Do I have to make it public and on the marketplace, just to be able to re-use it in my own private organization?
Does anyone have any experience setting up such an action?
Upvotes: 9
Views: 16721
Reputation: 8484
Expanding on @MujtabaMehdi's answer: the copying can actually be done as part of the action itself:
-
uses: actions/checkout@v3
with:
repository: your-org/your-action
path: your-action
-
uses: ./your-action
(This pollutes the current folder. I originally tried to checkout the action to /tmp/your-action
, but uses
only takes paths that start with ./
. You could still put it in the parent directory with ./../your-action
, but checkout
also doesn't want to write anything there -.-.)
Upvotes: 4
Reputation: 3620
Github has introduced a new repository sharing option, called internal. With internal repositories it is possible to share actions across repositories. Please note that only some types of organizational accounts are entitled to this visibility option.
https://dev.to/n3wt0n/finally-custom-github-actions-in-internal-repos-4l91
Upvotes: 1
Reputation: 84
I have recently published a custom action to GitHub marketplace, You have two options:
uses: ./
Do let me know if this solves your problem, thanks
Upvotes: 1