Skip to content

Add GitLab wiki URL resolver script#4

Open
benhunter wants to merge 1 commit intomasterfrom
codex/create-gitlab-wiki-url.sh-script
Open

Add GitLab wiki URL resolver script#4
benhunter wants to merge 1 commit intomasterfrom
codex/create-gitlab-wiki-url.sh-script

Conversation

@benhunter
Copy link
Owner

Motivation

  • Provide a small CLI helper to resolve the clone URL for a GitLab project or group wiki from a single GitLab URL.
  • Support environments with or without glab by falling back to curl with GITLAB_TOKEN for API access.
  • Give clear usage, error messages, and exit codes so callers can detect missing/disabled wikis programmatically.

Description

  • Add gitlab-wiki-url.sh which validates and parses a single GitLab URL and normalizes the host and path.
  • Query the GitLab API (base https://<host>/api/v4) using glab api when available or curl with PRIVATE-TOKEN: $GITLAB_TOKEN as a fallback via the api_get helper.
  • Attempt GET /projects/:urlencoded_path to detect a project and check wiki_enabled, returning the repo URL with .wiki.git or exiting 2 if the wiki is disabled.
  • If the project lookup 404s, attempt GET /groups/:urlencoded_path and then GET /groups/:id/wikis to determine a group wiki and return <group_web_url>.wiki.git, with distinct exit codes for not found, validation/API errors, and success.
  • Update README.md with the new script entry, required environment variable note for GITLAB_TOKEN, and example invocations.

Testing

  • No automated tests were run for this change.

Codex Task

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant