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

allow path parameter to be a YAML list #510

Open
mvdan opened this issue Jan 20, 2021 · 8 comments
Open

allow path parameter to be a YAML list #510

mvdan opened this issue Jan 20, 2021 · 8 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@mvdan
Copy link

mvdan commented Jan 20, 2021

The README example shows how with.path is meant to be specified - as a multi-line YAML string:

- uses: actions/cache@v2
  with:
    path: |
      ~/cache
      !~/cache/exclude
      **/node_modules

This correlates with what we can see in the code:

export function getInputAsArray(
name: string,
options?: core.InputOptions
): string[] {
return core
.getInput(name, options)
.split("\n")
.map(s => s.trim())
.filter(x => x !== "");
}

Unfortunately, this format is rather unfriendly to humans. It does not allow inline comments, for example, which would be really useful to document why certain paths are being cached. Worse even, attempting to use YAML-like comments results in silently broken caching; see mvdan/github-actions-golang#16.

I assume this is rooted at how action inputs are strings. At an internal level, that makes sense. However, at the user-facing YAML level, I think this action should take a YAML list, not a list-encoded-in-newline-separated-strings multiline string. Internally, the Actions software could turn the YAML list into the newline-separated string, and that could be entirely transparent to the user:

- uses: actions/cache@v2
  with:
    path:
    - ~/cache
    - !~/cache/exclude # some comment
    - **/node_modules  # some other comment

I realise this is probably an issue that cannot be fixed in this repository alone, but I still think it belongs in this repository as it is a very clear example that's making actions/cache harder to use properly. I'm completely fine with this issue being moved elsewhere, but please don't close it as "not a bug in this repository" :)

@github-actions
Copy link

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

@github-actions github-actions bot added the stale label Jan 21, 2022
@mvdan
Copy link
Author

mvdan commented Jan 21, 2022

Bad bot, this is not stale.

@dmarcoux
Copy link

dmarcoux commented Dec 7, 2022

This also hit me before I realized the cache wasn't working... I found this comment in #44.

dmarcoux pushed a commit to dmarcoux/elixir_templates that referenced this issue Dec 7, 2022
Otherwise, those comments are interpreted as part of the path and the
cache doesn't work. See actions/cache#510
@vsvipul vsvipul removed their assignment Mar 31, 2023
@github-actions
Copy link

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.

@github-actions github-actions bot added the stale label Oct 18, 2023
@mvdan
Copy link
Author

mvdan commented Oct 18, 2023

This issue is NOT stale. I would really appreciate it if your bot stopped pestering me every year. I would very much prefer to get any response from the maintainers, of course.

@github-actions github-actions bot removed the stale label Oct 19, 2023
@lng2020
Copy link

lng2020 commented Oct 26, 2023

It troubled me greatly when I wrote a tutorial about utilizing the action cache. In a tutorial, it's inevitable to use line comments. I'm surprised the string is treated in such a simple way. I agree with the comment above that it is a bug.

Copy link

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.

@github-actions github-actions bot added the stale label May 13, 2024
@mvdan
Copy link
Author

mvdan commented May 13, 2024

Again NOT STALE.

@github-actions github-actions bot removed the stale label May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

4 participants