actions / upload-artifact

MIT License
3.12k stars 702 forks source link

[bug] Specifying a symbolic link in the `file` parameter will not upload the target file anymore #589

Open anddani opened 1 month ago

anddani commented 1 month ago

What happened?

We are using upload-artifact to upload the result of a build step which yields a symbolic link to the actual output.

After updating to 4.3.5, our uploaded artifacts were only a handful of bytes even though the generated files are in megabytes. After downgrading to 4.3.4 it started working again.

What did you expect to happen?

We expect that when referring to a symbolic link, it should upload the file it points to, not the link itself.

How can we reproduce it?

Here is a repository to show how to reproduce this issue: https://github.com/anddani/upload-artifact-bug-repro/

Here is an example run: https://github.com/anddani/upload-artifact-bug-repro/actions/runs/10218539161

on:
  workflow_dispatch:

jobs:
  upload-artifact:
    name: Uploading file through symbolic link
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Write file
        run: |
          echo "My file" > file.txt
          ln -s file.txt symbolic-link.txt

      - name: Upload file 4.3.4
        uses: actions/upload-artifact@v4.3.4
        with:
          name: file-4-3-4.txt
          path: ./symbolic-link.txt

      - name: Upload file 4.3.5
        uses: actions/upload-artifact@v4.3.5
        with:
          name: file-4-3-5.txt
          path: ./symbolic-link.txt

Anything else we need to know?

No response

What version of the action are you using?

v4.3.5

What are your runner environments?

linux

Are you on GitHub Enterprise Server? If so, what version?

No response

robherley commented 1 month ago

Hey folks, we reverted & released a new version for v4.3.6 to address the regression.

sanjacob commented 1 month ago

This seems like a feature people want (as opt-in, rather than the default) #93 #508 Since it has already been added by accident, it would be nice to have it as an option.

Edit: after testing it seems not all symlinks are kept as such