jacob-meacham / serverless-plugin-git-variables

:zap: Expose git variables to serverless
MIT License
87 stars 32 forks source link

Use a more generic way to pull repo name #81

Open efimk-lu opened 3 years ago

efimk-lu commented 3 years ago

Extracting the repo name from the folder into which the git repo was cloned is dangerous. Mainly because the folder name can change. This is a more robust way of pulling it.

See https://stackoverflow.com/a/42543006

efimk-lu commented 3 years ago

Running git config --get remote.origin.url will return for example git@github.com:lumigo-io/python_tracer.git

efimk-lu commented 3 years ago

Hey @jverce, how can I merge the PR?

jverce commented 2 years ago

Any updates on this one?

This is especially needed when running on CI/CD pipelines like CircleCI where they clone the repo onto a generically named folder called project and we end up with something like this: image

efimk-lu commented 2 years ago

Hey @jverce, not yet.

jacob-meacham commented 2 years ago

Apologies, this fell off my radar! @efimk-lu would you mind adding a legacy escape for people relying on the old behavior, along with config to explicitly set the remote (defaulting to the first in the list is fine, but nice to let users specify a remote). Once that's done I'll merge and release

f00f commented 2 years ago

@jacob-meacham Using the folder name is annoying. Would this be the config logic you want? I might take the time to implement it. Can someone hint me at docs on how to define config parameters?

(parameter names below are just for illustration purposes. feel free to suggest good names)

If remote is configured, use that Else, if use_first_remote is configured to true, use first remote Else: old behaviour