actions / actions/cache

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

Open
#1,087 4 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area:path
Dominant language
TypeScript
Stars
5.6k
Forks
1.6k
PR merge metrics
No merged PRs in 30d

Description

#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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported workflow with actions/cache@v3 and inspect the warning produced during post-job cleanup. Trace how the cache action handles the logged path /home/runner/work/check-spelling/check-spelling/.//dictionaries; done means /./ is accepted while .. remains rejected, with any validation warning occurring at the expected stage.

Written by the indexing model from the issue text.

Assessment

Tech stack
github-actions, typescript
Domain
ci-cd
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.