Project url change after repository rename

Rokas Kupstys's Avatar

Rokas Kupstys

15 May, 2019 01:24 PM

Hello,
At some point i renamed my repository https://github.com/rokups/Urho3D to https://github.com/rokups/rbfx. I also renamed appveyor project, but it is still available under https://ci.appveyor.com/project/rokups/urho3d/ url. Is it possible to make project use https://ci.appveyor.com/project/rokups/rbfx url?

Thanks!

  1. Support Staff 1 Posted by Owen McDonnell on 15 May, 2019 03:47 PM

    Owen McDonnell's Avatar

    Yes, you can use this REST API call.
    Here is a sample script.

    $token = '<your_appveyor_api_token>'
    $headers = @{
      "Authorization" = "Bearer $token"
      "Content-type" = "application/json"
    }
    
    $response = Invoke-RestMethod -Uri 'https://ci.appveyor.com/api/projects/<your_account_name>/<current_project_slug>/settings' -Headers $headers -Method Get
    
    $response.settings.slug="<new_project_slug>"
    
    Invoke-RestMethod -Uri 'https://ci.appveyor.com/api/projects' -Headers $headers -Method PUT -Body ($response.settings | convertto-json -depth 5)
    
  2. 2 Posted by Rokas Kupstys on 17 May, 2019 04:05 PM

    Rokas Kupstys's Avatar

    If i try suggested command it errors out about missing project. My project is already named rbfx, only url contains old slug. Screenshot attached.

  3. Support Staff 3 Posted by Owen McDonnell on 17 May, 2019 05:56 PM

    Owen McDonnell's Avatar

    So your version of the script i offered contains,

    'https://ci.appveyor.com/api/projects/rokups/urho3d/settings' -Headers $headers -Method Get
    

    which gives an error?

  4. 4 Posted by Rokas Kupstys on 18 May, 2019 08:04 AM

    Rokas Kupstys's Avatar

    That is right. I copied token from https://ci.appveyor.com/api-keys and output i get is:

    Invoke-RestMethod : {"message":"Project not found or access denied."}
    At C:\Users\Administrator\Desktop\rename.ps1:11 char:1
    + Invoke-RestMethod -Uri 'https://ci.appveyor.com/api/projects' -Header ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebExc
       eption
        + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
    
  5. Support Staff 5 Posted by Owen McDonnell on 18 May, 2019 05:35 PM

    Owen McDonnell's Avatar

    Is it a v1 key (account specific - as in screenshot) or v2 key (all accounts)?

  6. 6 Posted by Rokas Kupstys on 19 May, 2019 07:23 AM

    Rokas Kupstys's Avatar

    I tried both keys which resulted in same error. However i noticed just now that url slug changed and i can now access project through https://ci.appveyor.com/project/rokups/rbfx URL. I assume you fixed it somehow, so thank you very much.

  7. Support Staff 7 Posted by Owen McDonnell on 20 May, 2019 03:47 AM

    Owen McDonnell's Avatar

    Nope... i did nothing.

    Perhaps you made the request twice but didn't realize it the first time, so the second time it failed since there was no longer a matching slug?

  8. Ilya Finkelshteyn closed this discussion on 20 Jul, 2019 09:01 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

 

01 Oct, 2024 04:27 PM
26 Sep, 2024 03:49 PM
26 Sep, 2024 09:02 AM
25 Sep, 2024 07:07 PM
24 Sep, 2024 08:39 PM
24 Sep, 2024 06:47 AM