Add 'lowercase' and other string manipulation functions #10553
Replies: 8 comments 10 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 appears At 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.
-
Please add more GitHub Actions expression functions for manipulating strings. Specifically, a
lowercase
function 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