mirror of
https://github.com/nektos/act.git
synced 2026-04-26 09:25:54 +03:00
[GH-ISSUE #1579] Allow to work with local actions outside of the repository we run the workflows from #792
Labels
No labels
area/action
area/cli
area/docs
area/image
area/runner
area/workflow
backlog
confirmed/not-planned
kind/bug
kind/discussion
kind/external
kind/feature-request
kind/question
meta/duplicate
meta/invalid
meta/need-more-info
meta/resolved
meta/wontfix
meta/workaround
needs-work
pull-request
review/not-planned
size/M
size/XL
size/XXL
stale
stale-exempt
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/act#792
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Porkepix on GitHub (Jan 23, 2023).
Original GitHub issue: https://github.com/nektos/act/issues/1579
Act version
act version 0.2.34
Feature description
It would be a nice feature, when developing a new action or more, several actions (for example to migrate from CircleCI's orbs to GitHub's actions) to be able to have like a "path" (I mean, the same way you'd add a location to your $PATH for your shell) act would be looking at/mounting, so that when fetching actions it could also get them from here, to allow for actions development offline and not only the workflows themselves.
Note that I might have missed the way to do so, but the best I could find was to copy and paste actions within the repo itself and change to call from the
org/reposyntax to a local one@trash-anger commented on GitHub (Feb 11, 2023):
I was about to create quite a similar feature request!
I'm working in a company which have quite a flexible remote work policy leading developers to travel a lot by flight. (which is currently my case)
I'm a new user of act and when I tried to use act during my previous flight I just got this message:
FATA[0000] dial udp 8.8.8.8:80: connect: network is unreachableSo landing I've been wondering how we could work offline an easy way, it could be nice to implement a caching solution allowing to fetch pipeline dependencies while running it. Then running it again would first try to reach online first (and update the cache as a result) and offline, would rely on the cache.
I'm currently adapting the pipelines of my company to get a custom behaviour depending on the
GITHUB_ACTIONSvar to allow anyone to build locally, and deploy the current component to a local k8s cluster.I'm thinking out loud:
@Porkepix , maybe you could use the workflow reuse function if it works and if you can refactor your pipeline.
@Porkepix commented on GitHub (Feb 11, 2023):
Act actually already cache actions, see
~/.cache/act. The issue here is rather that it tries to reach out Google's Public DNS which is curious to say the least. I noticed it too but didn't opened an issue, would definitely be interesting to know why it does that. And if every resources are available locally then, yes, I believe it should work 100% offline.What I had in mind was rather to have a clone of the actions repos and to provide them to act like you would with libs given to a compiler, or bineries in your
$PATH: a local place to look for those actions.I don't understand what you had in mind here.
@ChristopherHX commented on GitHub (Feb 11, 2023):
@trash-anger Please create a new issue about
FATA[0000] dial udp 8.8.8.8:80: connect: network is unreachableThis function should just return 127.0.0.1 on a network error and the artifact server might not work correctly.
github.com/nektos/act@c378a7d28b/pkg/common/outbound_ip.go (L14)@trash-anger commented on GitHub (Feb 11, 2023):
I'm boarding, I'll do that tonight!
@cardinalby commented on GitHub (Mar 18, 2023):
Act is great for testing Workflows. Developing individual actions I also tried to use act, but found that it's better to have integration tests. Especially for JavaScript actions where you can run your action locally offline, pass intputs, env, etc. and debug it, test its outputs, examine all commands issued by the action, etc.
I use github-action-ts-run-api for that.
@mcascone commented on GitHub (Jun 2, 2023):
All I want is to be able to develop my actions locally, separate from the repo with the workflow file that calls them.
Specifically, I want to be able to use a local path in the
uses:part of a workflow:Existing behavior
Desired functionality
Going by the output, there would need to be a trigger or flag to not tack the
https://github.comonto the path:@mverkerk-godaddy commented on GitHub (Aug 16, 2023):
I'm struggling with this too - I'm building a library of actions that can be shared across repos within our github org and when I'm testing this library locally with ACT, the
uses:pieces should point to.[/path]where otherwise, they should point to{org}/{repo}[/path]@ref...Currently, I have to (temporarily) update everything from
{org}/{repo}[/path]@refto.[/path], run ACT, and change everything back before I commit/push (easy to forget). I have written a bash script that takes care of this but that's not ideal. I'll include the script at the bottom of this message...In my testing, I have tried setting an ENV variable and/or using
env.ACTbut unfortunatelyuses:does not support variables (as far as I know)This example:
... failed with this error:
Error: Expected format {org}/{repo}[/path]@ref. Actual '${{ env.ACT && './.github/actions/my-action' || 'my-org/my-repo/.github/actions/my-action@main' }}' Input string was not in a correct formatwould be great if there was a flag like
--replace-ghe-path-with-local {org}/{repo}that would make this switch for us!btw: thanks for all the great work! really enjoying this tool! 👍🏼
Here's my
act_path_replace.shscript:@ChristopherHX commented on GitHub (Aug 16, 2023):
Please test this version of act https://github.com/ChristopherHX/act/pull/34.
Usage:
./act --local-repository "https://github.com/test/test@v0=$PWD" -W test.yml -P self-hosted=-self-hosted -vaction.yml in cwd
I need reviewer for https://github.com/nektos/act/pull/1954, because
--local-repositoryis based on that code.@reneleonhardt commented on GitHub (May 1, 2024):
Why was it closed after #1954 has been merged? 🤔
@ChristopherHX commented on GitHub (May 1, 2024):
Summary It was the wrong target repository and was used to keep it via GitHub UI uptodate.
Actually this has been merged by now, see
act --help.Since nobody has ever commented between our comments, I forget this issue exists. Please evaluate if this can be closed
@mcascone commented on GitHub (May 1, 2024):
is there any documentation on this other than the help text?
@ChristopherHX commented on GitHub (May 1, 2024):
Some more details here: https://github.com/nektos/act/pull/2155#issue-2088646390
Usage:
./act --local-repository "https://github.com/test/test@v0=$PWD" -W test.yml -P self-hosted=-self-hosted -vNow also possible
./act --local-repository "test/test@v0=$PWD" -W test.yml -P self-hosted=-self-hosted -vaction.yml in cwd
@reneleonhardt commented on GitHub (May 6, 2024):
@Porkepix Is your use case now possible?
I can't see from this --local-repository example if mcascone's intuitive feature request https://github.com/nektos/act/issues/1579#issuecomment-1574290406 works when replacing $PWD by the actual absolute path to the local
test/testrepo... if it's outside of $PWD 😅@ChristopherHX commented on GitHub (May 6, 2024):
That won't work and I don't agree with accepting yaml that GitHub Actions doesn't like to see. You would need to find someone else supporting such an idea, I'm not an owner of this project.
You should make shure it's an absolute path. If it's relative, I guarantee nothing and it could just fail.
E.g.
$PWDis really just a bash variable for an absolute path, there are no sanity checksThis is what you should be able to get working based on the referenced comment
act --local-repository myOrg/my-action@my-branch=/path/to/local/my-actionand/path/to/local/my-actionis created bygit clone myOrg/my-action -b my-branch my-actionwithin/path/to/local/. So/path/to/local/my-actioncontains the.gitdir and it's action.yml file.Feel free to come back to me with any error,
--local-repositoryis an feature flag it implies changing how actions are clonedIf you want to apply this automatically without adding the arg everytime create a
./.actrcfile like (don't use any", as this just do a split on the first space)You might be using this Software more often than I, even if I contributed more code
@ChristopherHX commented on GitHub (May 6, 2024):
The error messages if the folder/file doesn't exist are bad and only the
myOrg/my-action@my-branchpart shows up together with the tried file namesThis is what I mean, maybe it makes sense to log more about the hidden source of the action, the default implied by
--local-repositoryis also to use bare git clones of actions.To be honest using act might be really complicated by now with all it's cli flags and weird error messages
@jsoref commented on GitHub (Nov 4, 2024):
I was going to file a new issue for https://github.com/check-spelling-sandbox/nektos-act-issue-up-dir/actions/runs/11671555945 not working in act, but this issue technically is the right issue.
Summary:
./../(and presumably more than that, but whatever)..git/, but it would be much cleaner if I could leave them in./../instead..github/workflows/test.yml:action.ymlmain.jsGitHub
Act
@ChristopherHX commented on GitHub (Nov 4, 2024):
You mean this: https://github.com/nektos/act/pull/2108 that has an dedicated issue for this.
I refused to give my approval (+0/neutral), but I wouldn't block it if I'm overvoted by maintainers.