emmeowzing / gitlabci-lint-pre-commit-hook

A pre-commit hook that lints Gitlab CI configurations
https://pypi.org/project/pre-commit-gitlabci-lint/
MIT License
16 stars 3 forks source link

Is there any way we can query the project's ID automatically via API #36

Open emmeowzing opened 1 year ago

emmeowzing commented 1 year ago

We already request users provide a key. I wonder if we can just query the gitlab instance's API and check for the project's ID automatically and drop that requirement.

jzenoz commented 3 months ago

quick and dirty POC using an ssh remote url and jq:

curl -Ss --header "PRIVATE-TOKEN: <TOKEN>" "https://$(git remote get-url origin | sed 's/git@//;s/:.*//')/api/v4/projects/$(git remote get-url origin | sed 's/\.git//;s/.*://;s|/|%2F|g')" | jq .id