-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Issue: hashFiles function attempts to hash directories and errors with io.Copy error #1012
Comments
I think the problem is here: act/pkg/exprparser/functions.go Lines 208 to 216 in ff13844
Glob will return directories and files, and so after opening the file, diff --git a/pkg/exprparser/functions.go b/pkg/exprparser/functions.go
index 64103e0..a1c99fa 100644
--- a/pkg/exprparser/functions.go
+++ b/pkg/exprparser/functions.go
@@ -211,6 +211,14 @@ func (impl *interperterImpl) hashFiles(paths ...reflect.Value) (string, error) {
return "", fmt.Errorf("Unable to os.Open: %v", err)
}
+ fi, err := f.Stat()
+ if err != nil {
+ return "", fmt.Errorf("Unable to File.Stat: %v", err)
+ }
+ if fi.IsDir() {
+ continue
+ }
+
if _, err := io.Copy(hasher, f); err != nil {
return "", fmt.Errorf("Unable to io.Copy: %v", err)
}
|
Ok, it seems like the standard golang path/filepath
Issue about double star: golang/go#11862 and some alternatives: https://www.client9.com/golang-globs-and-the-double-star-glob-operator/ Here's some more information on the Edit: Here's the GitHub glob functionality implemented: https://github.com/actions/toolkit/tree/main/packages/glob and the |
these patterns are gitignore syntax, so you could just apply the reversed gitignore and walk through files act/pkg/container/docker_run.go Lines 579 to 592 in c802064
|
Issue is stale and will be closed in 14 days unless there is new activity |
System information
macOS
arm64 (64-bit)
yes
20.10.12
act
:ghcr.io/catthehacker/ubuntu@act-latest
act
version:v0.2.26-0.20220215200300-ff13844b8643
Expected behaviour
Running a workflow that includes this string interpolated works on GitHub actions:
It results in a string like so:
Example: https://github.com/stellar/go/runs/5309071935?check_suite_focus=true
Actual behaviour
Running the action with the string interperolated with
act
displays this error:It appears that
act
is interpreting thehashFiles('**', '!.git')
incorrectly and is attempting to hash directories, not just files.Workflow and/or repository
https://github.com/stellar/go/blob/189950c43f89ea908699953d298b120f1a81b371/.github/workflows/go.yml
Steps to reproduce
act
outputLog
The text was updated successfully, but these errors were encountered: