-
-
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
feat: Test writing remote Actions locally #2155
Conversation
🦙 MegaLinter status: ✅ SUCCESS
See detailed report in MegaLinter reports |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hey, you should probably squash any related commits. quality of life improvement so the devs don't have to navigate much.
Actually only two commits here are implementation for this pr. The rest is part of #1954, that's why I initially didn't create a pr for this. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2155 +/- ##
==========================================
+ Coverage 61.56% 61.99% +0.43%
==========================================
Files 53 56 +3
Lines 9002 9139 +137
==========================================
+ Hits 5542 5666 +124
- Misses 3020 3026 +6
- Partials 440 447 +7 ☔ View full report in Codecov by Sentry. |
007d256
to
2412cfd
Compare
2e041c9
to
ba69f85
Compare
local-repositories: | ||
https://github.com/nektos/test-override@a: testdata/actions/node20 | ||
nektos/test-override@b: testdata/actions/node16 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have added a new config.yml for tests, to configure selected config options
if purl, err := goURL.Parse(url); err == nil { | ||
if dest, ok := l.LocalRepositories[fmt.Sprintf("%s@%s", strings.TrimPrefix(purl.Path, "/"), ref)]; ok { | ||
l.CacheDirCache[fmt.Sprintf("%s@%s", cacheDir, ref)] = dest | ||
return ref, nil | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
short localrepository definition without uri host are now matchng
|
||
func (l *LocalRepositoryCache) Fetch(ctx context.Context, cacheDir, url, ref, token string) (string, error) { | ||
if dest, ok := l.LocalRepositories[fmt.Sprintf("%s@%s", url, ref)]; ok { | ||
l.CacheDirCache[fmt.Sprintf("%s@%s", cacheDir, ref)] = dest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The CacheDirCache no longer causes key collision if you override the same action with different version
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
How to test
Usage:
./act --local-repository "https://github.com/test/test@v0=$PWD" -W test.yml -P self-hosted=-self-hosted -v
Now also possible
./act --local-repository "test/test@v0=$PWD" -W test.yml -P self-hosted=-self-hosted -v
action.yml in cwd
Why?
Local actions cannot have pre steps and use a different syntax in the uses key