GitHub user jonnybot0 added a comment to the discussion: Historical issues

I do think we need to go through the old issues and migrate them to the new 
repository. I have read that Geb did that as some means of keeping issue 
numbers that matched the old CodeHaus Jira system. I suppose that was to 
prevent needing to update old issues.

Bulk transfer is pretty straightforward using the [GitHub 
CLI](https://github.com/cli/cli). 

There are about 280 instances of the `issueh` macro. Seems like it should be a 
straightforward, if a little bit tedious script to write to go through the 
historical issues, transfer them to the new repository, and then update the 
`issueh` reference to simply use the new `issue` macro and the new number.

I used a code generator to bash out something that should do this:
```
#!/bin/bash

# Variables
SOURCE_REPO="source_owner/source_repo"
DEST_REPO="dest_owner/dest_repo"
CODE_DIR="/path/to/your/codebase"

# List all issues in the source repository
issue_numbers=$(gh issue list -R "$SOURCE_REPO" -s all -L 500 --json number -q 
'.[].number')

# Iterate over each issue number
for old_issue_number in $issue_numbers; do
    # Transfer the issue and capture the new issue URL
    new_issue_url=$(gh issue transfer "$old_issue_number" 
"https://github.com/$DEST_REPO"; -R "$SOURCE_REPO" --json url -q '.url')

    # Extract the new issue number from the URL
    new_issue_number=$(echo "$new_issue_url" | grep -oP '(?<=/issues/)\d+')

    # Update references in the codebase
    if [ -n "$new_issue_number" ]; then
        echo "Updating references from issueh:$old_issue_number to 
issue:$new_issue_number"
        find "$CODE_DIR" -type f -exec sed -i '' 
"s/issueh:$old_issue_number/issue:$new_issue_number/g" {} +
    else
        echo "Failed to transfer issue #$old_issue_number"
    fi
done
```

Looks to me like it should work with a little testing. If there are no 
objections, I'll go ahead & do that a week from today (after spot-testing an 
issue or two).

GitHub link: 
https://github.com/apache/groovy-geb/discussions/229#discussioncomment-11652703

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]

Reply via email to