Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate dapr issues from dotnet/aspire #458

Open
davidfowl opened this issue Feb 9, 2025 · 11 comments
Open

Migrate dapr issues from dotnet/aspire #458

davidfowl opened this issue Feb 9, 2025 · 11 comments

Comments

@davidfowl
Copy link
Contributor

davidfowl commented Feb 9, 2025

https://github.com/dotnet/aspire/issues?q=is%3Aissue%20state%3Aopen%20label%3Adapr%20

cc @aaronpowell @FullStackChef @oising @paule96

@aaronpowell
Copy link
Member

I'll look into what would be required to migrate between orgs

@FullStackChef
Copy link
Contributor

Is it worth triaging these beforehand? Based on initial review some of these are either not issues or may have been addressed already

@aaronpowell
Copy link
Member

We could, but we don't have permission to close the issues on the Aspire repo, so we would have to wait for the Aspire team to help with that.

If we migrate them here first, then we have better control on them, we can also engage with the author without having a split dialog of the code being in one repo and the issue in another.

@aaronpowell
Copy link
Member

aaronpowell commented Feb 10, 2025

Bummer, you can't transfer issues between orgs (per the docs).

Here's a creative workaround that uses the fact you can move repos between orgs, but it might be a lot of overhead.

Probably easiest to just copy each issue across from the Aspire repo, tag the original author in our copy, close the original, and we can take it from there.

@oising
Copy link

oising commented Feb 10, 2025

Bummer, you can't transfer issues between orgs (per the docs).

Here's a creative workaround that uses the fact you can move repos between orgs, but it might be a lot of overhead.

Probably easiest to just copy each issue across from the Aspire repo, tag the original author in our copy, close the original, and we can take it from there.

It's a pity there are no programmers around here 😜Would need some mods to filter and select relevant issues.

# Define parameters
param (
    [string]$sourceOrg,
    [string]$sourceRepo,
    [string]$destOrg,
    [string]$destRepo,
    [string]$token
)

# Function to get issues from the source repository
function Get-Issues {
    param (
        [string]$org,
        [string]$repo,
        [string]$token
    )
    $url = "https://api.github.com/repos/$org/$repo/issues"
    $headers = @{
        Authorization = "token $token"
        Accept        = "application/vnd.github.v3+json"
    }
    Invoke-RestMethod -Uri $url -Headers $headers -Method Get
}

# Function to get comments for an issue
function Get-Comments {
    param (
        [string]$org,
        [string]$repo,
        [int]$issueNumber,
        [string]$token
    )
    $url = "https://api.github.com/repos/$org/$repo/issues/$issueNumber/comments"
    $headers = @{
        Authorization = "token $token"
        Accept        = "application/vnd.github.v3+json"
    }
    Invoke-RestMethod -Uri $url -Headers $headers -Method Get
}

# Function to create issues in the destination repository
function Create-Issue {
    param (
        [string]$org,
        [string]$repo,
        [string]$token,
        [string]$title,
        [string]$body
    )
    $url = "https://api.github.com/repos/$org/$repo/issues"
    $headers = @{
        Authorization = "token $token"
        Accept        = "application/vnd.github.v3+json"
    }
    $body = @{
        title = $title
        body  = $body
    } | ConvertTo-Json
    Invoke-RestMethod -Uri $url -Headers $headers -Method Post -Body $body
}

# Get issues from the source repository
$issues = Get-Issues -org $sourceOrg -repo $sourceRepo -token $token

# Migrate issues to the destination repository
foreach ($issue in $issues) {
    # Get comments for the issue
    $comments = Get-Comments -org $sourceOrg -repo $sourceRepo -issueNumber $issue.number -token $token

    # Format comments as a markdown table
    $commentsTable = "| Username | Timestamp | Comment |\n| --- | --- | --- |\n"
    foreach ($comment in $comments) {
        $commentsTable += "| $($comment.user.login) | $($comment.created_at) | $($comment.body) |\n"
    }

    # Create the new issue body with comments table
    $newBody = $issue.body + "`n`n### Comments`n" + $commentsTable

    # Create the issue in the destination repository
    Create-Issue -org $destOrg -repo $destRepo -token $token -title $issue.title -body $newBody
}

Write-Output "Issues and comments migrated successfully from $sourceOrg/$sourceRepo to $destOrg/$destRepo"

EDIT: will embed source issue's comments as an inline table in the body of the new issue in the target repo.

@davidfowl
Copy link
Contributor Author

@oising you need to handle comments too 😄

@oising
Copy link

oising commented Feb 10, 2025

@davidfowl

@oising you need to handle comments too 😄

Done.

@aaronpowell
Copy link
Member

Now make it an extension for the GitHub CLI 😝

@oising
Copy link

oising commented Feb 11, 2025

Now make it an extension for the GitHub CLI 😝

That sounds like fun. I didn't know it took extensions? I'll look into it; I need a less-stressful side project than working on Aspire :P

Copy link

github-actions bot commented Mar 4, 2025

We have noticed this issue has not been updated within 21 days. If there is no action on this issue in the next 14 days, we will automatically close it. You can use /stale-extend to extend the window.

@github-actions github-actions bot added the Stale label Mar 4, 2025
@aaronpowell
Copy link
Member

/stale-extend

@github-actions github-actions bot removed the Stale label Mar 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants