actions / cache

Cache dependencies and build outputs in GitHub Actions
MIT License
4.56k stars 1.21k forks source link

`Relative pathing '.' ... is not allowed` discriminates against local actions #1087

Open jsoref opened 1 year ago

jsoref commented 1 year ago

684 asked about relative paths, and was rejected because there were other things someone could do...

I'm developing an action and I'd like to cache content within my action. Most of the time, my action will be run from something like: /home/runner/work/check-spelling/check-spelling/, but when it's testing itself, the github.action_path property has a trailing ./. Afaict, GHA does not have string processing functions that would make stripping a trailing ./ or / easy to do.

The result is: https://github.com/jsoref/check-spelling/actions/runs/3993931770/jobs/6851091696

Run actions/cache@v3
  with:
    path: /home/runner/work/check-spelling/check-spelling/.//dictionaries
    key: check-spelling-dictionaries-
    enableCrossOsArchive: false
  env:
    workflow_check_commit_messages: commits
    PATH: /home/runner/work/check-spelling/check-spelling/.//wrappers:/home/runner/.local/bin:/opt/pipx_bin:/home/runner/.cargo/bin:/home/runner/.config/composer/vendor/bin:/usr/local/.ghcup/bin:/home/runner/.dotnet/tools:/snap/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
    replace_v3_actions_checkout: 1
Cache not found for input keys: check-spelling-dictionaries-

followed by

Post job cleanup.
Post job cleanup.
Warning: Invalid pattern '/home/runner/work/check-spelling/check-spelling/.//dictionaries'. Relative pathing '.' and '..' is not allowed.

Rejecting '..' is perfectly reasonable. Rejecting /./ seems questionable, especially given that GHA naturally constructs paths of this form.

If GHA were to not construct paths of this form (which would make me otherwise happy), I'd be happy to close this Issue...


p.s. it would be nicer if the complaint about "relative pathing" was triggered in the normal uses stage instead of in the post stage.

github-actions[bot] commented 1 year ago

This issue is stale because it has been open for 200 days with no activity. Leave a comment to avoid closing this issue in 5 days.

jsoref commented 1 year ago

☹️

github-actions[bot] commented 7 months ago

This issue is stale because it has been open for 200 days with no activity. Leave a comment to avoid closing this issue in 5 days.

jsoref commented 7 months ago

😞🤕