-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow to work with local actions outside of the repository we run the workflows from #1579
Comments
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: So 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 I'm thinking out loud:
@Porkepix , maybe you could use the workflow reuse function if it works and if you can refactor your pipeline. |
Act actually already cache actions, see 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
I don't understand what you had in mind here. |
@trash-anger Please create a new issue about This function should just return 127.0.0.1 on a network error and the artifact server might not work correctly. Line 14 in c378a7d
|
I'm boarding, I'll do that tonight! |
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. |
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 Existing behaviorjobs:
Deploy:
steps:
- uses: 'myOrg/my-action@my-branch' Desired functionalityjobs:
Deploy:
steps:
- uses: '/path/to/local/my-action@my-branch' Going by the output, there would need to be a trigger or flag to not tack the git clone 'https://github.com/~/myOrg' # ref=my-branch
[My-Action/Deploy] Unable to clone https://github.com/~/myOrg refs/heads/my-branch: repository not found |
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 Currently, I have to (temporarily) update everything from In my testing, I have tried setting an ENV variable and/or using This example:
... failed with this error:
would be great if there was a flag like btw: thanks for all the great work! really enjoying this tool! 👍🏼 Here's my #!/usr/bin/env bash
target=${1}
if [ "$target" == "--to-remote" ]; then
echo "Updating [action.yml] files to point to [org/repo/.github/actions]"
FILES=$(find . -name "action.yml" -type f -exec grep -l "uses:.*\.\/\.github\/actions\/" {} \;)
for file in $FILES; do
sed -i 's|./.github/actions|org/repo/.github/actions|g' "$file"
sed -i '/uses:.*\.github\/actions\//!b;/@v2/b;s/$/@v2/' "$file"
done
elif [ "$target" == "--to-local" ]; then
echo "Updating [action.yml] files to point to [./.github/actions]"
FILES=$(find . -name "action.yml" -type f -exec grep -l "uses:.*org\/repo\/\.github\/actions\/" {} \;)
for file in $FILES; do
sed -i 's|org/repo|.|g' "$file"
sed -i 's|@v2$||g' "$file"
done
else
echo "Please specify a target: local or remote"
exit 1
fi
|
Please test this version of act ChristopherHX#34. Usage: on: push
jobs:
_:
runs-on: self-hosted
steps:
- uses: test/test@v0 action.yml in cwd runs:
using: composite
steps:
- run: echo Test I need reviewer for #1954, because |
Why was it closed after #1954 has been merged? 🤔 |
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 Since nobody has ever commented between our comments, I forget this issue exists. Please evaluate if this can be closed |
is there any documentation on this other than the help text?
|
Some more details here: #2155 (comment) Usage: Now also possible on: push
jobs:
_:
runs-on: self-hosted
steps:
- uses: test/test@v0 action.yml in cwd runs:
using: composite
steps:
- run: echo Test |
@Porkepix Is your use case now possible? I can't see from this --local-repository example if mcascone's intuitive feature request #1579 (comment) works when replacing $PWD by the actual absolute path to the local |
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. This is what you should be able to get working based on the referenced comment jobs:
Deploy:
steps:
- uses: 'myOrg/my-action@my-branch'
Feel free to come back to me with any error, If you want to apply this automatically without adding the arg everytime create a
You might be using this Software more often than I, even if I contributed more code |
The error messages if the folder/file doesn't exist are bad and only the This is what I mean, maybe it makes sense to log more about the hidden source of the action, the default implied by
To be honest using act might be really complicated by now with all it's cli flags and weird error messages |
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:
on:
push:
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: |
mkdir ../action
mv * ../action
- uses: ./../action runs:
using: node20
main: main.js console.log("hello world") GitHubRun mkdir ../action
Run ./../action
hello world Act[test.yml/test] ⭐ Run Main actions/checkout@v4
[test.yml/test] 🐳 docker cp src=/Users/jsoref/code/nektos/issues/up-dir/. dst=/Users/jsoref/code/nektos/issues/up-dir
[test.yml/test] ✅ Success - Main actions/checkout@v4
[test.yml/test] ⭐ Run Main mkdir ../action
mv * ../action
[test.yml/test] 🐳 docker exec cmd=[bash -e /var/run/act/workflow/1] user= workdir=
[test.yml/test] ✅ Success - Main mkdir ../action
mv * ../action
[test.yml/test] ⭐ Run Main ./../action
[test.yml/test] ❌ Failure - Main ./../action
[test.yml/test] failed to read 'action.yml' from action './../action' with path '' of step file does not exist
failed to read 'action.yaml' from action './../action' with path '' of step file does not exist
failed to read 'Dockerfile' from action './../action' with path '' of step file does not exist
[test.yml/test] 🏁 Job failed
Error: Job 'test' failed |
You mean this: #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. |
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/repo
syntax to a local oneThe text was updated successfully, but these errors were encountered: