Upload files with specific file extensions

As previously I opened an issue at: upload files with specific file extensions · Issue #178 · actions/upload-artifact · GitHub
But answer doesn’t seems to be working.

Answer was: path: **/*.exe
But says undefined alias path: **/*.exe

* in YAML references an anchor, e.g. *A references whatever was defined with &A. Add quotes to explicitly make the value a string:

path: '**/*.exe'

Hi sir,
thanks for jet reply.

I have set as advised, But no luck.

    - name: Upload Artifact
      uses: actions/upload-artifact@v1.0.0
       name: Releases
       path: '**/*.exe'

Please see my full yml file: RunSomeAware/Csharp_Compiler.yml at 5ec6f148a9243a21c828202c78a7a66f33ac1427 · DarkSecDevelopers/RunSomeAware · GitHub

Error msg:

 Error: Path does not exist D:\a\RunSomeAware\RunSomeAware\**\*.exe
Error: Exit code 1 returned from process: file name 'c:\runners\2.278.0\bin\Runner.PluginHost.exe', arguments 'action "GitHub.Runner.Plugins.Artifact.PublishArtifact, Runner.Plugins"'.

My guess is that this feature only works on Unix shells. (i.e. it’s depending on the shell to do the expansion.)

I’d suggest filing another bug. The inconsistent behavior is really unacceptable.

(Sorry, I don’t have the energy to file this bug. But, you should try to be more polite than I would be when you file it.)

Are you sure its a bug ?
And what you mean by inconsistent behavior ?

80% certain (this is fairly low for me).

Inconsistent in that it does one thing on macOS and Linux, and a different thing on Windows.

It’s generally reasonable to expect the same behavior on all supported platforms unless otherwise documented, and I haven’t seen any documentation saying otherwise.

1 Like

It’s a Windows runner and the workflow uses the default shell, which is pwsh in this case. PowerShell Core appears to support path expansion. ls **\*.exe worked in my test. However, judging by the error message, the shell does not appear to be involved at all. Whatever tries to work with the supplied path **/*.exe manages to turn the forward into a backward slash, but then seems to interpret the path literally instead of expanding it to just files with the extension .exe from any subfolders.

The expectation is that the glob pattern **/*.exe should work across all runner operating systems. The readme of actions/upload-artifact states that it uses @actions/glob for wildcard matching. In turn, its readme indirectly states that it supports Windows and there’s no remark about issues with globbing on Windows: toolkit/packages/glob at main · actions/toolkit · GitHub
I even tried it out in Node.js and it appears to work fine:

const glob = require("@actions/glob")
glob.create("C:/path/to/**/*.exe").then(g => g.glob().then(r => console.dir(r)))

Looking at the workflow, I realized that it uses a super outdated version of the actions/upload-artifacts action. It probably doesn’t support globbing.

    - name: Upload Artifact
      uses: actions/upload-artifact@v1.0.0
       name: Releases
       path: '**/*.exe'

Replace it with the following code that changes the version to v2 (and fixes the indentation):

    - name: Upload Artifact
      uses: actions/upload-artifact@v2
        name: Releases
        path: '**/*.exe'

Thanks so much. You are professional. It worked.
I was using old artifact version.
Now it works fine: Update Csharp_Compiler.yml · DarkSecDevelopers/RunSomeAware@33be108 · GitHub

Cheers ! :heart: