Skip to content
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

Using 'regex' to download multiple files renames files #48

Open
samspencer5991 opened this issue May 23, 2022 · 4 comments
Open

Using 'regex' to download multiple files renames files #48

samspencer5991 opened this issue May 23, 2022 · 4 comments
Labels
bug Something isn't working

Comments

@samspencer5991
Copy link

I'm currently using this to download all available files from the repo in my GH action. The issue is that the downloaded files are then renamed with the passed file name with the original filename appended.

For example, in my repo I have four files, all beginning with 'bridge'. So I can download all of them by passing file: "bridge", but then my files end up looking like: "bridgebridge...."

Is there a way to avoid this and just keep the original file names?

@Korkman
Copy link

Korkman commented Jun 7, 2022

As a workaround, specify
target: "./"

@dsaltares
Copy link
Owner

The issue is that target is the full target file path. In the context of downloading multiple files, this option makes a bit less sense. Not all downloaded files can have the same target file path because they would collide.

There are 2 options.

  1. We change target to mean target directory, which would solve your problem but would be a backwards-incompatible change that needs to be released under a new major version.
  2. You use the workaround suggested by @Korkman, target: "./".

@samspencer5991 what do you think?

@afk-mario
Copy link

I specified the target but still get the files renamed not sure if I'm doing something wrong

      - name: download latest build
        id: get_release
        uses: dsaltares/[email protected]
        with:
          version: "latest"
          file: "don-salmon-.*\\.zip"
          regex: true
          target: "./"
          token: "${{ secrets.GITHUB_TOKEN }}"

@dechamps
Copy link

I just hit the same issue - basically, the problem is that the combination of this line:

const target = inputTarget === '' ? file : inputTarget;

And this line:

outputPath: usesRegex ? `${target}${asset.name}` : target,

Results in hilarity when the config is something like:

      - uses: dsaltares/[email protected]
        with:
          file: '.+\.(tar\.gz|whl)$'
          regex: true

@Korkman's workaround of setting target to ./ works because that prevents target from being set to file. Ideally that should just be the default behaviour.

@dsaltares dsaltares added the bug Something isn't working label Apr 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants