Add 'lowercase' and other string manipulation functions #10553
Replies: 12 comments 14 replies
-
| That's true; I don't want to add too many functions to the syntax, but there are a few that would be very useful, including case changing. I appreciate your feedback, and we'll put it on the backlog. | 
Beta Was this translation helpful? Give feedback.
-
| There are workarounds if anyone is interested: That said, I would love to have this built in. | 
Beta Was this translation helpful? Give feedback.
-
| Another motivational example: conan-io/conan#11705. | 
Beta Was this translation helpful? Give feedback.
-
| It's not that problematic when you need to change letter cases in shell, because shells usually has built-in feature for that (and I believe it shows how frequent we need changing letter cases). However, when you need to change letter cases before put it in input parameters of actions, it gets us in trouble. Here's another motivational example.  Whereas GitHub's container registry disallows image names to contain any upper letters,  - uses: docker/build-push-action@v3
  with:
    push: true
    tags: ghcr.io/${{ github.repository }}:latest  # Does not work if any upper letter appearsAt present, I need to work around this problem by utilizing shell script: - id: lower-repo
  shell: pwsh
  run: |
    "::set-output name=repository::$($env:GITHUB_REPOSITORY.ToLowerInvariant())"
- uses: docker/build-push-action@v3
  with:
    push: true
    tags: ghcr.io/${{ steps.lower-repo.outputs.repository }}:latest | 
Beta Was this translation helpful? Give feedback.
-
| Another thing I ran into lately, which could probably be argued against: I had job with an `if: inputs.stuff=='string' and of course, users may type mixed case and spoil the if check. Still, a simple  | 
Beta Was this translation helpful? Give feedback.
-
| Good lord. Ran into the same thing trying to use the native github actions repository variables. There's just no decent way without having this as part of the language. | 
Beta Was this translation helpful? Give feedback.
-
| In my case my predecessor settled on mixed case organization name (github.com/MyOrganization rather than github.com/myorganization). The organization name is just too useful not to use for e.g. docker image repository names, but certain operations failed (or looked odd) when not using lower case. So now each workflow gets additional lines of code because there is no lower() function. | 
Beta Was this translation helpful? Give feedback.
-
| Why not follow  
 | 
Beta Was this translation helpful? Give feedback.
-
| +1 | 
Beta Was this translation helpful? Give feedback.
-
| Do I see that correctly that currently every single job that wants to use a Docker image named after the project has to include an extra step that makes a lowercase version of  | 
Beta Was this translation helpful? Give feedback.
-
| Hey there from Actions 👋 - we do not have this currently on the roadmap, but I will look into what it takes to get this added. Just to set expectations at current funding i wouldn't expect this one to come for the next 6 months. | 
Beta Was this translation helpful? Give feedback.
-
| Another idea is to avoid putting complex logic (which unfortunately includes case manipulation here) into the workflow definition. Write a script in whatever language is appropriate for the project, and do your manipulation there. Then call that script from your Actions workflow or composite action. There are reasons why this might be a better idea. With scripts, you can run more of your workflow locally, without needing whatever passes as a 'run your Actions locally' tool to do it. This can cut down on the amount of Actions minutes you consume testing stuff. It also makes it easier to adapt to Actions syntax changes and/or move to another CI tool, should you need to do that. Finally, a local script in the language you're already using is probably more familiar to your team than Actions yaml. | 
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Please add more GitHub Actions expression functions for manipulating strings. Specifically, a
lowercasefunction would be very beneficial, but generally, there is no way to set environment variables across the entire workflow if they require even basic manipulation (such as converting to lowercase).Motivation: https://github.community/t/github-actions-repository-name-must-be-lowercase/184924
Beta Was this translation helpful? Give feedback.
All reactions