guitarrapc / git-shallow-clone-orb

circleci orb to execute git shallow clone for faster checkout.
https://circleci.com/orbs/registry/orb/guitarrapc/git-shallow-clone
MIT License
21 stars 11 forks source link

Shallow cloning fails when running on pull request #34

Closed kasperpeulen closed 1 year ago

kasperpeulen commented 1 year ago

When I run the API for a pull request:

curl -X POST --location "https://circleci.com/api/v2/project/gh/storybookjs/storybook/pipeline" \
              -H "Content-Type: application/json" \
              -H "Circle-Token: $CIRCLE_CI_TOKEN" \
              -d '{
                    "branch": "pull/19768/head",
                    "parameters": {
                      "workflow": "pr"
                    }
                  }'

I get an error in the shallow clone:

+ '[' /home/circleci = / ']'
+ mkdir -p /home/circleci/.ssh
++ command -v ssh-keyscan
+ '[' -x /usr/bin/ssh-keyscan ']'
+ '[' false == true ']'
+ '[' false == true ']'
+ '[' false '!=' true ']'
+ echo 'github.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==
'
+ '[' false '!=' true ']'
+ echo 'bitbucket.org ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAubiN81eDcafrgMeLzaFPsw2kNvEcqTKl/VqLat/MaB33pZy0y3rJZtnqwR2qOOvbwKZYKiEO1O6VqNEBxKvJJelCq0dTXWT5pbO2gDXC6h6QDXCaHo6pOHGPUy+YBaGQRGuSusMEASYiWunYN0vCAI8QaXnWMXNMdFP3jHAJH0eDsoiGnLPBlBp4TNm6rYI74nMzgz3B9IikW4WVK+dc8KZJZWYjAuORU3jc1c/NPskD2ASinf8v3xnfXeukU0sJ5N6m5E8VLjObPEO+mN2t/FZTMZLiFqPWc/ALSqnMnnhwrNi2rbfg/rd/IpL8Le3pSBne8+seeFVBoGqzHM9yXw==
'
+ umask 077
+ touch /home/circleci/.ssh/id_rsa
+ chmod 0600 /home/circleci/.ssh/id_rsa
+ echo
+ git config --global url.ssh://git@github.com.insteadOf https://github.com
+ git config --global gc.auto 0
+ git clone --depth 1 --verbose git@github.com:storybookjs/storybook.git .
Cloning into '.'...
Warning: Permanently added the RSA host key for IP address '140.82.113.4' to the list of known hosts.

remote: Enumerating objects: 4644, done.        
remote: Counting objects:   0% (1/4644)        
remote: Counting objects:   1% (47/4644)        
remote: Counting objects:   2% (93/4644)        
remote: Counting objects:   3% (140/4644)        
remote: Counting objects:   4% (186/4644)        
remote: Counting objects:   5% (233/4644)        
remote: Counting objects:   6% (279/4644)        
remote: Counting objects:   7% (326/4644)        
remote: Counting objects:   8% (372/4644)        
remote: Counting objects:   9% (418/4644)        
remote: Counting objects:  10% (465/4644)        
remote: Counting objects:  11% (511/4644)        
remote: Counting objects:  12% (558/4644)        
remote: Counting objects:  13% (604/4644)        
remote: Counting objects:  14% (651/4644)        
remote: Counting objects:  15% (697/4644)        
remote: Counting objects:  16% (744/4644)        
remote: Counting objects:  17% (790/4644)        
remote: Counting objects:  18% (836/4644)        
remote: Counting objects:  19% (883/4644)        
remote: Counting objects:  20% (929/4644)        
remote: Counting objects:  21% (976/4644)        
remote: Counting objects:  22% (1022/4644)        
remote: Counting objects:  23% (1069/4644)        
remote: Counting objects:  24% (1115/4644)        
remote: Counting objects:  25% (1161/4644)        
remote: Counting objects:  26% (1208/4644)        
remote: Counting objects:  27% (1254/4644)        
remote: Counting objects:  28% (1301/4644)        
remote: Counting objects:  29% (1347/4644)        
remote: Counting objects:  30% (1394/4644)        
remote: Counting objects:  31% (1440/4644)        
remote: Counting objects:  32% (1487/4644)        
remote: Counting objects:  33% (1533/4644)        
remote: Counting objects:  34% (1579/4644)        
remote: Counting objects:  35% (1626/4644)        
remote: Counting objects:  36% (1672/4644)        
remote: Counting objects:  37% (1719/4644)        
remote: Counting objects:  38% (1765/4644)        
remote: Counting objects:  39% (1812/4644)        
remote: Counting objects:  40% (1858/4644)        
remote: Counting objects:  41% (1905/4644)        
remote: Counting objects:  42% (1951/4644)        
remote: Counting objects:  43% (1997/4644)        
remote: Counting objects:  44% (2044/4644)        
remote: Counting objects:  45% (2090/4644)        
remote: Counting objects:  46% (2137/4644)        
remote: Counting objects:  47% (2183/4644)        
remote: Counting objects:  48% (2230/4644)        
remote: Counting objects:  49% (2276/4644)        
remote: Counting objects:  50% (2322/4644)        
remote: Counting objects:  51% (2369/4644)        
remote: Counting objects:  52% (2415/4644)        
remote: Counting objects:  53% (2462/4644)        
remote: Counting objects:  54% (2508/4644)        
remote: Counting objects:  55% (2555/4644)        
remote: Counting objects:  56% (2601/4644)        
remote: Counting objects:  57% (2648/4644)        
remote: Counting objects:  58% (2694/4644)        
remote: Counting objects:  59% (2740/4644)        
remote: Counting objects:  60% (2787/4644)        
remote: Counting objects:  61% (2833/4644)        
remote: Counting objects:  62% (2880/4644)        
remote: Counting objects:  63% (2926/4644)        
remote: Counting objects:  64% (2973/4644)        
remote: Counting objects:  65% (3019/4644)        
remote: Counting objects:  66% (3066/4644)        
remote: Counting objects:  67% (3112/4644)        
remote: Counting objects:  68% (3158/4644)        
remote: Counting objects:  69% (3205/4644)        
remote: Counting objects:  70% (3251/4644)        
remote: Counting objects:  71% (3298/4644)        
remote: Counting objects:  72% (3344/4644)        
remote: Counting objects:  73% (3391/4644)        
remote: Counting objects:  74% (3437/4644)        
remote: Counting objects:  75% (3483/4644)        
remote: Counting objects:  76% (3530/4644)        
remote: Counting objects:  77% (3576/4644)        
remote: Counting objects:  78% (3623/4644)        
remote: Counting objects:  79% (3669/4644)        
remote: Counting objects:  80% (3716/4644)        
remote: Counting objects:  81% (3762/4644)        
remote: Counting objects:  82% (3809/4644)        
remote: Counting objects:  83% (3855/4644)        
remote: Counting objects:  84% (3901/4644)        
remote: Counting objects:  85% (3948/4644)        
remote: Counting objects:  86% (3994/4644)        
remote: Counting objects:  87% (4041/4644)        
remote: Counting objects:  88% (4087/4644)        
remote: Counting objects:  89% (4134/4644)        
remote: Counting objects:  90% (4180/4644)        
remote: Counting objects:  91% (4227/4644)        
remote: Counting objects:  92% (4273/4644)        
remote: Counting objects:  93% (4319/4644)        
remote: Counting objects:  94% (4366/4644)        
remote: Counting objects:  95% (4412/4644)        
remote: Counting objects:  96% (4459/4644)        
remote: Counting objects:  97% (4505/4644)        
remote: Counting objects:  98% (4552/4644)        
remote: Counting objects:  99% (4598/4644)        
remote: Counting objects: 100% (4644/4644)        
remote: Counting objects: 100% (4644/4644), done.        
remote: Compressing objects:   0% (1/3533)        
remote: Compressing objects:   1% (36/3533)        
remote: Compressing objects:   2% (71/3533)        
remote: Compressing objects:   3% (106/3533)        
remote: Compressing objects:   4% (142/3533)        
remote: Compressing objects:   5% (177/3533)        
remote: Compressing objects:   6% (212/3533)        
remote: Compressing objects:   7% (248/3533)        
remote: Compressing objects:   8% (283/3533)        
remote: Compressing objects:   9% (318/3533)        
remote: Compressing objects:  10% (354/3533)        
remote: Compressing objects:  11% (389/3533)        
remote: Compressing objects:  12% (424/3533)        
remote: Compressing objects:  13% (460/3533)        
remote: Compressing objects:  14% (495/3533)        
remote: Compressing objects:  15% (530/3533)        
remote: Compressing objects:  16% (566/3533)        
remote: Compressing objects:  17% (601/3533)        
remote: Compressing objects:  18% (636/3533)        
remote: Compressing objects:  19% (672/3533)        
remote: Compressing objects:  20% (707/3533)        
remote: Compressing objects:  21% (742/3533)        
remote: Compressing objects:  22% (778/3533)        
remote: Compressing objects:  23% (813/3533)        
remote: Compressing objects:  24% (848/3533)        
remote: Compressing objects:  25% (884/3533)        
remote: Compressing objects:  26% (919/3533)        
remote: Compressing objects:  27% (954/3533)        
remote: Compressing objects:  28% (990/3533)        
remote: Compressing objects:  29% (1025/3533)        
remote: Compressing objects:  30% (1060/3533)        
remote: Compressing objects:  31% (1096/3533)        
remote: Compressing objects:  32% (1131/3533)        
remote: Compressing objects:  33% (1166/3533)        
remote: Compressing objects:  34% (1202/3533)        
remote: Compressing objects:  35% (1237/3533)        
remote: Compressing objects:  36% (1272/3533)        
remote: Compressing objects:  37% (1308/3533)        
remote: Compressing objects:  38% (1343/3533)        
remote: Compressing objects:  39% (1378/3533)        
remote: Compressing objects:  40% (1414/3533)        
remote: Compressing objects:  41% (1449/3533)        
remote: Compressing objects:  42% (1484/3533)        
remote: Compressing objects:  43% (1520/3533)        
remote: Compressing objects:  44% (1555/3533)        
remote: Compressing objects:  45% (1590/3533)        
remote: Compressing objects:  46% (1626/3533)        
remote: Compressing objects:  47% (1661/3533)        
remote: Compressing objects:  48% (1696/3533)        
remote: Compressing objects:  49% (1732/3533)        
remote: Compressing objects:  50% (1767/3533)        
remote: Compressing objects:  51% (1802/3533)        
remote: Compressing objects:  52% (1838/3533)        
remote: Compressing objects:  53% (1873/3533)        
remote: Compressing objects:  54% (1908/3533)        
remote: Compressing objects:  55% (1944/3533)        
remote: Compressing objects:  56% (1979/3533)        
remote: Compressing objects:  57% (2014/3533)        
remote: Compressing objects:  58% (2050/3533)        
remote: Compressing objects:  59% (2085/3533)        
remote: Compressing objects:  60% (2120/3533)        
remote: Compressing objects:  61% (2156/3533)        
remote: Compressing objects:  62% (2191/3533)        
remote: Compressing objects:  63% (2226/3533)        
remote: Compressing objects:  64% (2262/3533)        
remote: Compressing objects:  65% (2297/3533)        
remote: Compressing objects:  66% (2332/3533)        
remote: Compressing objects:  67% (2368/3533)        
remote: Compressing objects:  68% (2403/3533)        
remote: Compressing objects:  69% (2438/3533)        
remote: Compressing objects:  70% (2474/3533)        
remote: Compressing objects:  71% (2509/3533)        
remote: Compressing objects:  72% (2544/3533)        
remote: Compressing objects:  73% (2580/3533)        
remote: Compressing objects:  74% (2615/3533)        
remote: Compressing objects:  75% (2650/3533)        
remote: Compressing objects:  76% (2686/3533)        
remote: Compressing objects:  77% (2721/3533)        
remote: Compressing objects:  78% (2756/3533)        
remote: Compressing objects:  79% (2792/3533)        
remote: Compressing objects:  80% (2827/3533)        
remote: Compressing objects:  81% (2862/3533)        
remote: Compressing objects:  82% (2898/3533)        
remote: Compressing objects:  83% (2933/3533)        
remote: Compressing objects:  84% (2968/3533)        
remote: Compressing objects:  85% (3004/3533)        
remote: Compressing objects:  86% (3039/3533)        
remote: Compressing objects:  87% (3074/3533)        
remote: Compressing objects:  88% (3110/3533)        
remote: Compressing objects:  89% (3145/3533)        
remote: Compressing objects:  90% (3180/3533)        
remote: Compressing objects:  91% (3216/3533)        
remote: Compressing objects:  92% (3251/3533)        
remote: Compressing objects:  93% (3286/3533)        
remote: Compressing objects:  94% (3322/3533)        
remote: Compressing objects:  95% (3357/3533)        
remote: Compressing objects:  96% (3392/3533)        
remote: Compressing objects:  97% (3428/3533)        
remote: Compressing objects:  98% (3463/3533)        
remote: Compressing objects:  99% (3498/3533)        
remote: Compressing objects: 100% (3533/3533)        
remote: Compressing objects: 100% (3533/3533), done.        
Receiving objects:   0% (1/4644)
Receiving objects:   1% (47/4644)
Receiving objects:   2% (93/4644)
Receiving objects:   3% (140/4644)
Receiving objects:   4% (186/4644)
Receiving objects:   5% (233/4644)
Receiving objects:   6% (279/4644)
Receiving objects:   7% (326/4644)
Receiving objects:   8% (372/4644)
Receiving objects:   9% (418/4644)
Receiving objects:  10% (465/4644)
Receiving objects:  11% (511/4644)
Receiving objects:  12% (558/4644)
Receiving objects:  13% (604/4644)
Receiving objects:  14% (651/4644)
Receiving objects:  15% (697/4644)
Receiving objects:  16% (744/4644)
Receiving objects:  17% (790/4644)
Receiving objects:  18% (836/4644)
Receiving objects:  19% (883/4644)
Receiving objects:  20% (929/4644)
Receiving objects:  21% (976/4644)
Receiving objects:  22% (1022/4644)
Receiving objects:  23% (1069/4644)
Receiving objects:  24% (1115/4644)
Receiving objects:  25% (1161/4644)
Receiving objects:  26% (1208/4644)
Receiving objects:  27% (1254/4644)
Receiving objects:  28% (1301/4644)
Receiving objects:  29% (1347/4644)
Receiving objects:  30% (1394/4644)
Receiving objects:  31% (1440/4644)
Receiving objects:  32% (1487/4644)
Receiving objects:  33% (1533/4644)
Receiving objects:  34% (1579/4644)
Receiving objects:  35% (1626/4644)
Receiving objects:  36% (1672/4644)
Receiving objects:  37% (1719/4644)
Receiving objects:  38% (1765/4644)
Receiving objects:  39% (1812/4644)
Receiving objects:  40% (1858/4644)
Receiving objects:  41% (1905/4644)
Receiving objects:  42% (1951/4644)
Receiving objects:  43% (1997/4644)
Receiving objects:  44% (2044/4644)
Receiving objects:  45% (2090/4644)
Receiving objects:  46% (2137/4644)
Receiving objects:  47% (2183/4644)
Receiving objects:  48% (2230/4644)
Receiving objects:  49% (2276/4644)
Receiving objects:  50% (2322/4644)
Receiving objects:  51% (2369/4644)
Receiving objects:  52% (2415/4644)
Receiving objects:  53% (2462/4644)
Receiving objects:  54% (2508/4644)
Receiving objects:  55% (2555/4644)
Receiving objects:  56% (2601/4644)
Receiving objects:  57% (2648/4644)
Receiving objects:  58% (2694/4644)
Receiving objects:  59% (2740/4644)
Receiving objects:  60% (2787/4644)
Receiving objects:  61% (2833/4644)
Receiving objects:  62% (2880/4644)
Receiving objects:  63% (2926/4644)
Receiving objects:  64% (2973/4644)
Receiving objects:  65% (3019/4644)
Receiving objects:  66% (3066/4644)
Receiving objects:  67% (3112/4644)
Receiving objects:  68% (3158/4644)
Receiving objects:  69% (3205/4644)
Receiving objects:  70% (3251/4644), 17.12 MiB | 34.23 MiB/s
Receiving objects:  71% (3298/4644), 17.12 MiB | 34.23 MiB/s
Receiving objects:  72% (3344/4644), 17.12 MiB | 34.23 MiB/s
Receiving objects:  73% (3391/4644), 17.12 MiB | 34.23 MiB/s
Receiving objects:  74% (3437/4644), 17.12 MiB | 34.23 MiB/s
Receiving objects:  75% (3483/4644), 17.12 MiB | 34.23 MiB/s
Receiving objects:  76% (3530/4644), 17.12 MiB | 34.23 MiB/s
Receiving objects:  77% (3576/4644), 17.12 MiB | 34.23 MiB/s
Receiving objects:  78% (3623/4644), 17.12 MiB | 34.23 MiB/s
Receiving objects:  79% (3669/4644), 17.12 MiB | 34.23 MiB/s
Receiving objects:  80% (3716/4644), 17.12 MiB | 34.23 MiB/s
Receiving objects:  81% (3762/4644), 17.12 MiB | 34.23 MiB/s
Receiving objects:  82% (3809/4644), 17.12 MiB | 34.23 MiB/s
Receiving objects:  83% (3855/4644), 17.12 MiB | 34.23 MiB/s
Receiving objects:  84% (3901/4644), 17.12 MiB | 34.23 MiB/s
Receiving objects:  85% (3948/4644), 17.12 MiB | 34.23 MiB/s
Receiving objects:  86% (3994/4644), 17.12 MiB | 34.23 MiB/s
Receiving objects:  87% (4041/4644), 17.12 MiB | 34.23 MiB/s
Receiving objects:  88% (4087/4644), 17.12 MiB | 34.23 MiB/s
Receiving objects:  89% (4134/4644), 17.12 MiB | 34.23 MiB/s
Receiving objects:  90% (4180/4644), 17.12 MiB | 34.23 MiB/s
Receiving objects:  91% (4227/4644), 17.12 MiB | 34.23 MiB/s
Receiving objects:  92% (4273/4644), 17.12 MiB | 34.23 MiB/s
Receiving objects:  93% (4319/4644), 17.12 MiB | 34.23 MiB/s
Receiving objects:  94% (4366/4644), 17.12 MiB | 34.23 MiB/s
Receiving objects:  95% (4412/4644), 17.12 MiB | 34.23 MiB/s
Receiving objects:  96% (4459/4644), 17.12 MiB | 34.23 MiB/s
Receiving objects:  97% (4505/4644), 17.12 MiB | 34.23 MiB/s
remote: Total 4644 (delta 1141), reused 2203 (delta 859), pack-reused 0        
Receiving objects:  98% (4552/4644), 17.12 MiB | 34.23 MiB/s
Receiving objects:  99% (4598/4644), 17.12 MiB | 34.23 MiB/s
Receiving objects: 100% (4644/4644), 17.12 MiB | 34.23 MiB/s
Receiving objects: 100% (4644/4644), 34.48 MiB | 38.76 MiB/s, done.
Resolving deltas:   0% (0/1141)
Resolving deltas:   1% (12/1141)
Resolving deltas:   2% (23/1141)
Resolving deltas:   3% (36/1141)
Resolving deltas:   4% (46/1141)
Resolving deltas:   5% (62/1141)
Resolving deltas:   6% (69/1141)
Resolving deltas:   7% (80/1141)
Resolving deltas:   8% (93/1141)
Resolving deltas:   9% (103/1141)
Resolving deltas:  10% (115/1141)
Resolving deltas:  11% (126/1141)
Resolving deltas:  12% (137/1141)
Resolving deltas:  13% (151/1141)
Resolving deltas:  14% (162/1141)
Resolving deltas:  15% (172/1141)
Resolving deltas:  16% (183/1141)
Resolving deltas:  17% (194/1141)
Resolving deltas:  18% (206/1141)
Resolving deltas:  19% (219/1141)
Resolving deltas:  20% (229/1141)
Resolving deltas:  21% (240/1141)
Resolving deltas:  22% (252/1141)
Resolving deltas:  23% (264/1141)
Resolving deltas:  24% (274/1141)
Resolving deltas:  25% (286/1141)
Resolving deltas:  26% (298/1141)
Resolving deltas:  27% (309/1141)
Resolving deltas:  28% (320/1141)
Resolving deltas:  29% (331/1141)
Resolving deltas:  30% (343/1141)
Resolving deltas:  31% (354/1141)
Resolving deltas:  32% (366/1141)
Resolving deltas:  33% (377/1141)
Resolving deltas:  34% (388/1141)
Resolving deltas:  35% (400/1141)
Resolving deltas:  36% (412/1141)
Resolving deltas:  37% (423/1141)
Resolving deltas:  38% (434/1141)
Resolving deltas:  39% (447/1141)
Resolving deltas:  40% (457/1141)
Resolving deltas:  41% (470/1141)
Resolving deltas:  42% (480/1141)
Resolving deltas:  43% (491/1141)
Resolving deltas:  44% (503/1141)
Resolving deltas:  45% (514/1141)
Resolving deltas:  46% (526/1141)
Resolving deltas:  47% (537/1141)
Resolving deltas:  48% (548/1141)
Resolving deltas:  49% (560/1141)
Resolving deltas:  50% (572/1141)
Resolving deltas:  51% (582/1141)
Resolving deltas:  52% (594/1141)
Resolving deltas:  53% (605/1141)
Resolving deltas:  54% (617/1141)
Resolving deltas:  55% (628/1141)
Resolving deltas:  56% (639/1141)
Resolving deltas:  57% (651/1141)
Resolving deltas:  58% (663/1141)
Resolving deltas:  59% (674/1141)
Resolving deltas:  60% (685/1141)
Resolving deltas:  61% (698/1141)
Resolving deltas:  62% (708/1141)
Resolving deltas:  63% (719/1141)
Resolving deltas:  64% (731/1141)
Resolving deltas:  65% (743/1141)
Resolving deltas:  66% (754/1141)
Resolving deltas:  67% (765/1141)
Resolving deltas:  68% (776/1141)
Resolving deltas:  69% (788/1141)
Resolving deltas:  70% (801/1141)
Resolving deltas:  71% (811/1141)
Resolving deltas:  72% (823/1141)
Resolving deltas:  73% (834/1141)
Resolving deltas:  74% (845/1141)
Resolving deltas:  75% (856/1141)
Resolving deltas:  76% (868/1141)
Resolving deltas:  77% (881/1141)
Resolving deltas:  78% (890/1141)
Resolving deltas:  79% (902/1141)
Resolving deltas:  80% (913/1141)
Resolving deltas:  81% (925/1141)
Resolving deltas:  82% (938/1141)
Resolving deltas:  83% (948/1141)
Resolving deltas:  84% (959/1141)
Resolving deltas:  85% (971/1141)
Resolving deltas:  86% (982/1141)
Resolving deltas:  87% (993/1141)
Resolving deltas:  88% (1005/1141)
Resolving deltas:  89% (1016/1141)
Resolving deltas:  90% (1027/1141)
Resolving deltas:  91% (1039/1141)
Resolving deltas:  92% (1050/1141)
Resolving deltas:  93% (1062/1141)
Resolving deltas:  94% (1074/1141)
Resolving deltas:  95% (1085/1141)
Resolving deltas:  96% (1096/1141)
Resolving deltas:  97% (1107/1141)
Resolving deltas:  98% (1119/1141)
Resolving deltas:  99% (1130/1141)
Resolving deltas: 100% (1141/1141)
Resolving deltas: 100% (1141/1141), done.
+ cd .
+ '[' -n '' ']'
++ echo pull/19768/head
++ grep -e '^pull/*'
+ [[ -n pull/19768/head ]]
+ git fetch --depth 10 --force origin pull/19768/head/head:remotes/origin/pull/19768/head
fatal: couldn't find remote ref pull/19768/head/head

Exited with code exit status 128

This line seems to be the problem: https://github.com/guitarrapc/git-shallow-clone-orb/blob/master/src/commands/checkout_advanced.yml#L103

I also tried calling the API with: "branch": "pull/19768" instead of "branch": "pull/19768" but that gives me a branch not found error. (400)

guitarrapc commented 1 year ago

Seems like grep should consider exclude head?

kasperpeulen commented 1 year ago

@guitarrapc I think that should work yes!

guitarrapc commented 1 year ago

By the way, can you clarify what happen when calling curl without head, like below?

curl -X POST --location "https://circleci.com/api/v2/project/gh/storybookjs/storybook/pipeline" \
              -H "Content-Type: application/json" \
              -H "Circle-Token: $CIRCLE_CI_TOKEN" \
              -d '{
                    "branch": "pull/19768",
                    "parameters": {
                      "workflow": "pr"
                    }
                  }'
kasperpeulen commented 1 year ago

@guitarrapc I get a 400:

{
  "message" : "Branch not found"
}
kasperpeulen commented 1 year ago

Also the API documentation says to use: pull/<number>/head

https://circleci.com/docs/api/v2/index.html#operation/triggerPipeline

guitarrapc commented 1 year ago

Thank you! I will fix it.

guitarrapc commented 1 year ago

note: Before merging PR, I've try reproduce issue at my test lab but error not happen. Testing with following success.

https://app.circleci.com/pipelines/github/guitarrapc/git-shallow-clone-test/18/workflows/b8211779-3505-48cb-b5f8-5fd54bf5a8b2

CIRCLE_CI_TOKEN=YOUR_TOKEN
curl -X POST --location "https://circleci.com/api/v2/project/gh/guitarrapc/git-shallow-clone-test/pipeline" \
-H "Content-Type: application/json" \
-H "Circle-Token: $CIRCLE_CI_TOKEN" \
-d '{
    "branch": "pull/2/head"
    }'
guitarrapc commented 1 year ago

ok, reproduced.

https://app.circleci.com/pipelines/github/guitarrapc/git-shallow-clone-test/23/workflows/f4e4d1df-4baf-41a8-aa82-526fbd1fb442/jobs/36

  1. Prepare config.yaml with git-shallow-clone/checkout_advanced.
  2. Dispatch build via CircleCI API, checkout failed.
version: 2.1
orbs:
  git-shallow-clone: guitarrapc/git-shallow-clone@2.4.0
jobs:
  test:
    docker:
      - image: cimg/base:stable
    steps:
      - git-shallow-clone/checkout_advanced
      - run: echo "this is the test job"

workflows:
  build_and_test:
    jobs:
      - test
guitarrapc commented 1 year ago

@kasperpeulen Hi, I've released v2.4.1 and confirm fixed on my lab. Please reopen if issue still exists.

version: 2.1
orbs:
  git-shallow-clone: guitarrapc/git-shallow-clone@2.4.1
jobs:
  test:
    docker:
      - image: cimg/base:stable
    steps:
      - git-shallow-clone/checkout_advanced
      - run: echo "this is the test job"

workflows:
  build_and_test:
    jobs:
      - test

Thanks,

kasperpeulen commented 1 year ago

Thanks! Trying it out now :)