Helper scripts for Pagure->Forge migration and subsequent adjustment tasks
Find a file
2025-12-03 10:28:14 +01:00
.cursor/plans add forge_migrate_story_points.py 2025-11-28 16:43:47 +01:00
.gitignore add pagure_add_migration_comment.py 2025-11-28 16:43:34 +01:00
forge_migrate_story_points.py add "AI-generated" comment to each script 2025-12-03 10:28:14 +01:00
pagure_add_migration_comment.py add "AI-generated" comment to each script 2025-12-03 10:28:14 +01:00
pagure_create_issues.py add "AI-generated" comment to each script 2025-12-03 10:28:14 +01:00
README.md readme: Remove unsupported --comment arg from example 2025-12-02 14:13:16 +01:00
requirements.txt add pagure_add_migration_comment.py 2025-11-28 16:43:34 +01:00

Forge Helpers

This repository contains various helpers used for migrating Fedora QA repositories from Pagure into Fedora Forge (based on Forgejo), and mass-changing the target tickets if there is some subsequent action needed.

Setup

# Create and activate virtualenv
python3 -m venv .venv
source .venv/bin/activate

# Install dependencies
pip install -r requirements.txt

Pagure API Token

Several scripts require a Pagure API token for authentication. To create one:

  1. Log in to Pagure
  2. Go to your API settings
  3. Click "Create new API key"
  4. Select the required ACLs (e.g., "Comment on a ticket" for adding migration comments)
  5. Save the token to a file (e.g., ~/.pagure-token) for use with --token-file

Forge (Forgejo) API Token

Several scripts require a Forge API token for authentication. To create one:

  1. Log in to Fedora Forge
  2. Go to your Applications settings
  3. Under "Manage Access Tokens", enter a token name and select the required scopes (e.g., "write:issue" for modifying issues)
  4. Click "Generate Token"
  5. Save the token to a file (e.g., ~/.forge-token) for use with --token-file

Scripts

pagure_add_migration_comment.py

Adds a migration notice comment to Pagure tickets, linking to their new Forge location.

Usage:

# Dry run on all issues (preview without making changes)
python pagure_add_migration_comment.py https://pagure.io/fedora-qa/some-repo \
    https://forge.fedoraproject.org/quality/some-repo \
    --token-file ~/.pagure-token --dry-run

# Process specific issues on staging instances
python pagure_add_migration_comment.py https://stg.pagure.io/fedora-qa/some-repo \
    https://forge.stg.fedoraproject.org/quality/some-repo \
    --token-file ~/.pagure-token --issues 1 2 3

Run with --help for all available options.

pagure_create_issues.py

Creates numbered test issues in a Pagure repository. Useful for testing or setting up migration scenarios.

Usage:

# Dry run creating 5 issues (preview without making changes)
python pagure_create_issues.py https://pagure.io/fedora-qa/some-repo \
    --count 5 --token-file ~/.pagure-token --dry-run

# Create 10 issues on staging Pagure
python pagure_create_issues.py https://stg.pagure.io/fedora-qa/some-repo \
    --count 10 --token-file ~/.pagure-token

# Create issues with longer delay between calls
python pagure_create_issues.py https://pagure.io/fedora-qa/some-repo \
    --count 3 --token-file ~/.pagure-token --delay 2.0

Run with --help for all available options.

forge_migrate_story_points.py

Migrates story points from Pagure custom fields to Forge labels. Reads the story_points custom field from Pagure issues and applies corresponding point labels (points/01, points/02, points/03, points/05, points/08, points/13) to the matching Forge issues.

Usage:

# Dry run on all issues (preview without making changes)
python forge_migrate_story_points.py https://pagure.io/fedora-qa/some-repo \
    https://forge.fedoraproject.org/quality/some-repo \
    --token-file ~/.forge-token --dry-run

# Process specific issues
python forge_migrate_story_points.py https://pagure.io/fedora-qa/some-repo \
    https://forge.fedoraproject.org/quality/some-repo \
    --token-file ~/.forge-token --issues 1 2 3

Run with --help for all available options.

Note

Most of the code in this repository is AI-generated using Claude (Anthropic) via Cursor IDE.