sourcegit icon indicating copy to clipboard operation
sourcegit copied to clipboard

feat: add Built-in parameters: `DIRNAME`, #1628, #1633

Open heartacker opened this issue 5 months ago • 10 comments

heartacker avatar Aug 02 '25 10:08 heartacker

You should use working directory of the custom action's process, which is always the path of repository

love-linger avatar Aug 04 '25 02:08 love-linger

we just want the folder name, the folder name is fix and part of path, dirname remains unchanged, just like path, and we also need to use dirname for better processing please

heartacker avatar Aug 04 '25 02:08 heartacker

I know the path is fixed, but I only need the name of the folder. And this folder is fixed just like the path, which is very useful for custom processing. I need to get the name of the folder instead of the name of the path

heartacker avatar Aug 04 '25 02:08 heartacker

DIR_NAME=$(basename `pwd`)

love-linger avatar Aug 04 '25 02:08 love-linger

it can not work in action command,

DIR_NAME=$(basename `pwd`)
PixPin_2025-08-04_10-52-40

heartacker avatar Aug 04 '25 02:08 heartacker

https://github.com/sourcegit-scm/sourcegit/issues/1629

heartacker avatar Aug 04 '25 02:08 heartacker

PixPin_2025-08-04_11-20-29

heartacker avatar Aug 04 '25 03:08 heartacker

It's a shell expr. You should use echo "$(basename `pwd`)"

love-linger avatar Aug 04 '25 03:08 love-linger

image image

love-linger avatar Aug 04 '25 03:08 love-linger

That is to say, even for further customized requirements, even if they are simple, I have to use the shell. Moreover, under different operating systems, such as Linux or Windows, I also have to write specific and different commands for the operating systems to achieve the same function.

heartacker avatar Aug 04 '25 05:08 heartacker