Add workflow to transfer issues from another mozilla repository #4
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Transfer issues | |
on: | |
pull_request: | |
workflow_dispatch: | |
inputs: | |
count: | |
description: How many issues to transfer | |
default: "1" | |
required: true | |
from_name: | |
description: "the name of the mozilla/<from_name repository to transfer issues from" | |
required: true | |
permissions: | |
contents: write | |
issues: write | |
jobs: | |
transfer: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Transfer | |
if: github.event_name == 'workflow_dispatch' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
shell: bash | |
run: | | |
COUNT=${{ inputs.count }} | |
GITHUB_URL="${{ github.server_url }}" | |
GITHUB_ORG="${{ github.event.repository.owner }}" | |
FROM_NAME="${{ inputs.from_name }}" | |
TO_NAME="${{ github.event.repository.name }}" | |
FROM_REPO="$GITHUB_URL/$GITHUB_ORG/$FROM_NAME" | |
TO_REPO="$GITHUB_URL/$GITHUB_ORG/$TO_NAME" | |
REPO_LABEL="repository:$FROM_NAME" | |
# gh label clone $FROM_REPO -R $TO_REPO --force | |
# gh label create $REPO_LABEL -R $TO_REPO | |
# transfer_issue() { | |
# issue_number=$1 | |
# from_repo=$2 | |
# to_repo=$3 | |
# repo_label=$4 | |
# echo "$from_repo/issues/$issue_number" >> old-issues.txt | |
# result=$(gh issue transfer "$issue_number" "$to_repo") | |
# echo "$result" >> new-issues.txt | |
# echo "Transferred issue $issue_number to $result" | |
# gh issue -R $to_repo edit $result --add-label $repo_label | |
# } | |
# export -f transfer_issue | |
# echo "Transferring issues from \"$FROM_REPO\" to \"$TO_REPO\"" | |
# gh issue list -R "$FROM_REPO" -s all -L $COUNT --json number --search sort:created-asc --jq '.[] | .number' | xargs -P 4 -I % bash -c -e 'transfer_issue % '"$FROM_REPO $TO_REPO $REPO_LABEL" 2>&1 | |
# cat old-issues.txt | |
# cat new-issues.txt |