mirror of
https://github.com/nektos/act.git
synced 2026-04-26 01:15:51 +03:00
[GH-ISSUE #1012] Issue: hashFiles function attempts to hash directories and errors with io.Copy error #594
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#594
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 @leighmcculloch on GitHub (Feb 24, 2022).
Original GitHub issue: https://github.com/nektos/act/issues/1012
System information
macOSarm64 (64-bit)yes20.10.12act:ghcr.io/catthehacker/ubuntu@act-latestactversion:v0.2.26-0.20220215200300-ff13844b8643Expected 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
actdisplays this error:It appears that
actis interpreting thehashFiles('**', '!.git')incorrectly and is attempting to hash directories, not just files.Workflow and/or repository
github.com/stellar/go@189950c43f/.github/workflows/go.ymlSteps to reproduce
actoutputLog
@leighmcculloch commented on GitHub (Feb 24, 2022):
I think the problem is here:
github.com/nektos/act@ff13844b86/pkg/exprparser/functions.go (L208-L216)Glob will return directories and files, and so after opening the file,
actshould check if the file is a directory and skip it if so. Something like:@ZauberNerd commented on GitHub (Feb 24, 2022):
Ok, it seems like the standard golang path/filepath
Glob/Matchimplementation is incompatible with the GitHub syntax.**to match any directory in any depth.!to exclude matches.Issue about double star: https://github.com/golang/go/issues/11862 and some alternatives: https://www.client9.com/golang-globs-and-the-double-star-glob-operator/
Unfortunately most of the mentioned alternatives don't support the
!negation pattern.The glob implementation that is used inside
godoseems to be the most compatible and maybe we can use it as a dependency (https://pkg.go.dev/gopkg.in/godo.v2/glob) although it doesn't have ago.modfile and theglob/glob.gofile is part of the overall maingodopackage. Also, it seems like the last commit has been 7 years ago: https://github.com/go-godo/godo/tree/v2/glob.Here's some more information on the
hashFilesfunction: https://docs.github.com/en/actions/learn-github-actions/expressions#hashfiles and on the filter patterns: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#filter-pattern-cheat-sheetEdit: Here's the GitHub glob functionality implemented: https://github.com/actions/toolkit/tree/main/packages/glob and the
hashFilesimplementation is here: https://github.com/actions/runner/tree/main/src/Misc/expressionFunc/hashFiles@catthehacker commented on GitHub (Feb 24, 2022):
these patterns are gitignore syntax, so you could just apply the reversed gitignore and walk through files
github.com/nektos/act@c802064975/pkg/container/docker_run.go (L579-L592)@github-actions[bot] commented on GitHub (Mar 27, 2022):
Issue is stale and will be closed in 14 days unless there is new activity