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

Incompatible with non-git repositories #68

Open
meskill opened this issue Nov 27, 2024 · 4 comments
Open

Incompatible with non-git repositories #68

meskill opened this issue Nov 27, 2024 · 4 comments

Comments

@meskill
Copy link
Contributor

meskill commented Nov 27, 2024

This is a rare case, especially when using GitHub, but there are options to use VCS other than git, e.g. Jujutsu. But gh-workflow relies on the git repository and git binary available here

let root_dir = String::from_utf8(
Command::new("git")
.args(["rev-parse", "--show-toplevel"])
.output()?
.stdout,
)?;

Consider using other approaches to find proper root to put the workflow files. Maybe https://github.com/azzamsa/toor could be helpful

@tusharmath
Copy link
Contributor

Should be a simple change. Feel free to raise a PR.

@simonsan
Copy link
Contributor

simonsan commented Nov 29, 2024

cargo metadata has the field: workspace_root, this could be of help, I think.

https://docs.rs/cargo_metadata/0.19.0/cargo_metadata/

Though thinking about it, this would bind it to a repository containing a cargo project, not sure if that is wanted. 😅

@tusharmath
Copy link
Contributor

Thanks @simonsan. Toor is designed just to find the root. If it's not a very large library we should go ahead.

@simonsan
Copy link
Contributor

simonsan commented Nov 29, 2024

Thanks @simonsan. Toor is designed just to find the root. If it's not a very large library we should go ahead.

I think it's not worth it to pull in a library with 2k downloads and with the insecurity of being maintained any further, the logic is just a few LOC.

https://github.com/azzamsa/toor/blob/master/src/project.rs

Essentially, it looks for some hardcoded patterns in the directories, goes to the parent. I think that could be boiled down to a 3-5 LOC. That being said, you probably want to have a way to determine a repository based on the ability of the .github/workflows directory?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants