drupalorg-cli
drupalorg-cli copied to clipboard
Support for issue forks
Drupal.org opened issue forks: https://www.drupal.org/project/drupalorg/issues/3152637
You create an issue fork, and fetch it via GraphQL then locally
git remote add commerce-3150917 [email protected]:issue/commerce-3150917.git
We should add commands that help ease this until the Web UI is complete
Some of the GraphQL queries to https://git.drupalcode.org/api/graphql
{"query":"query projectFetch($path: ID!) {project(fullPath: $path) {\n httpUrlToRepo\n sshUrlToRepo\n repository {\n rootRef\n }\n }}","variables":{"path":"issue/commerce-3152516"}}
And to fetch the branches
https://git.drupalcode.org/api/v4/projects/issue%2Fcommerce-3152516/repository/branches?per_page=100&page=1
It doesn't look like there is any API entry for knowing if a project has issue forks enabled or not, but we can just query the GraphQL instance to see if there are any issue forks
curl 'https://git.drupalcode.org/api/graphql' \
-H 'authority: git.drupalcode.org' \
-H 'pragma: no-cache' \
-H 'cache-control: no-cache' \
-H 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36' \
-H 'content-type: application/json' \
-H 'accept: */*' \
-H 'origin: https://www.drupal.org' \
-H 'sec-fetch-site: cross-site' \
-H 'sec-fetch-mode: cors' \
-H 'sec-fetch-dest: empty' \
-H 'referer: https://git.drupalcode.org/' \
-H 'accept-language: en-US,en;q=0.9' \
--data-binary $'{"query":"query projectFetch($path: ID\u0021) {project(fullPath: $path) {\\n httpUrlToRepo\\n sshUrlToRepo\\n repository {\\n rootRef\\n }\\n }}","variables":{"path":"issue/commerce-3150917"}}' \
--compressed