Skip to content

Migrate gh2changelog to monorepo as local submodule#307

Merged
Songmu merged 6 commits intomainfrom
copilot/migrate-gh2changelog-to-monorepo
Feb 14, 2026
Merged

Migrate gh2changelog to monorepo as local submodule#307
Songmu merged 6 commits intomainfrom
copilot/migrate-gh2changelog-to-monorepo

Conversation

Copy link
Contributor

Copilot AI commented Feb 14, 2026

Migration of gh2changelog to monorepo

Plan

  • Create gh2changelog/ subdirectory
  • Copy library files from Songmu/gh2changelog repository
    • Copy main library files (gh2changelog.go, changelog.go, git.go, github.go, options.go, version.go)
    • Copy test files (changelog_test.go, gh2changelog_test.go, util_test.go)
    • Copy CHANGELOG.md
  • Create gh2changelog/go.mod with proper module name and dependencies
  • Update tagpr.go import statement to use local submodule
  • Update root go.mod to remove old dependency and add replace directive
  • Run go mod tidy to clean up dependencies
  • Create gh2changelog/.tagpr configuration file
    • Use changelogFile instead of changelog
    • Paths are relative to repository root (gh2changelog/version.go, gh2changelog/CHANGELOG.md)
  • Create .github/workflows/tagpr-gh2changelog.yaml
    • Use marketplace action pinned to commit hash (v1.15.0)
    • Set config parameter to gh2changelog/.tagpr
  • Verify build with go build ./...
  • Verify tests pass in both root and gh2changelog subdirectory
  • Run code quality checks (goimports, go vet, staticcheck)

Key Configuration Details

Path Resolution

When using a custom config file via TAGPR_CONFIG_FILE, all paths in the configuration (versionFile, changelogFile) must be specified relative to the repository root, not relative to the config file location. This is why gh2changelog/.tagpr contains:

  • versionFile = gh2changelog/version.go
  • changelogFile = gh2changelog/CHANGELOG.md

Action Pinning

The workflow uses the tagpr marketplace action pinned to a specific commit hash (78a926ba835e34721053309043aee696ba9c70b1) corresponding to v1.15.0, following security best practices for supply chain protection.

Original prompt

This section details on the original issue you should resolve

<issue_title>Migrate gh2changelog to monorepo management</issue_title>
<issue_description>## Overview

Move the library code from Songmu/gh2changelog into the gh2changelog/ subdirectory of Songmu/tagpr, managed as a separate Go module (github.com/Songmu/tagpr/gh2changelog). tagpr will depend on this local submodule instead of the external package.

Background

tagpr depends on Songmu/gh2changelog, but editing both simultaneously has become cumbersome. This issue migrates gh2changelog into the tagpr monorepo.

Tasks

1. Create gh2changelog/ subdirectory and copy files

  • Create gh2changelog/ directory
  • Copy the following files from Songmu/gh2changelog repository:
    • gh2changelog.go, changelog.go, git.go, github.go, options.go, version.go
    • changelog_test.go, gh2changelog_test.go, util_test.go
  • Do NOT include CLI-related files (cli.go, cmd/)

2. Create gh2changelog/go.mod

  • Module name: github.com/Songmu/tagpr/gh2changelog
  • Port dependencies from Songmu/gh2changelog go.mod
  • Match Go version with tagpr root module

3. Switch tagpr dependency to the local submodule

  • Change import in tagpr.go from "github.com/Songmu/gh2changelog" to "github.com/Songmu/tagpr/gh2changelog"
  • Remove old dependency github.com/Songmu/gh2changelog v0.6.0 from root go.mod
  • Run go mod tidy to clean up

4. Create gh2changelog/.tagpr

  • Configure tagPrefix for monorepo support:
    [tagpr]
        vPrefix = true
        releaseBranch = main
        versionFile = version.go
        release = false
        tagPrefix = gh2changelog/
    
  • release = false disables GitHub Release creation within this repository

5. Verify build and tests

  • Run go build ./... to confirm overall build
  • Run go test and cd gh2changelog && go test to confirm tests pass

Future changes to Songmu/gh2changelog (out of scope, documented for context)

  • Songmu/gh2changelog will depend on github.com/Songmu/tagpr/gh2changelog
  • Library code will be removed; only cli.go and cmd/gh2changelog/main.go will remain
  • It will become a build-and-release-only repository for the CLI command

Notes

  • The gh2changelog module is github.com/Songmu/tagpr/gh2changelog, versioned independently with gh2changelog/vX.Y.Z tags
  • Existing users of github.com/Songmu/gh2changelog will not be affected in the short term

Files to copy

File Role Copy?
gh2changelog.go Main logic
changelog.go Changelog format conversion
git.go Git command execution
github.go GitHub client creation
options.go Functional option pattern
version.go Version constant
changelog_test.go Tests
gh2changelog_test.go Tests
util_test.go Mock helper
cli.go CLI entry point
cmd/ main function
Makefile Build tooling
install.sh Install script
</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits February 14, 2026 08:05
…orts

Co-authored-by: Songmu <177122+Songmu@users.noreply.github.com>
Co-authored-by: Songmu <177122+Songmu@users.noreply.github.com>
Copilot AI changed the title [WIP] Migrate gh2changelog to monorepo management Migrate gh2changelog to monorepo as local submodule Feb 14, 2026
Copilot AI requested a review from Songmu February 14, 2026 08:09
Copy link
Owner

@Songmu Songmu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot

  • Let's also move gh2changelog/CHANGELOG.md.
  • Add settings related to the changelog path in gh2changelog/.tagpr.
  • Please create .github/workflows/tagpr-gh2changelog.yaml.

…angelog

Co-authored-by: Songmu <177122+Songmu@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 14, 2026

@copilot

  • Let's also move gh2changelog/CHANGELOG.md....

Done! All three changes have been implemented in commit db394e4:

  1. Moved gh2changelog/CHANGELOG.md from the original repository
  2. Added changelog = CHANGELOG.md to gh2changelog/.tagpr
  3. Created .github/workflows/tagpr-gh2changelog.yaml that:
    • Triggers on pushes to main with paths filter for gh2changelog/**
    • Runs tagpr from the gh2changelog directory
    • Uses the same authentication and setup as the root tagpr workflow

Copilot AI requested a review from Songmu February 14, 2026 08:26
Copy link
Owner

@Songmu Songmu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Please use changelogFile instead of changelog in gh2changelog/.tagpr.
    • Check the tagpr implementation to confirm whether the file path should be relative to .tagpr or the repository root.
    • Similarly, verify and adjust the path specification for versionFile to ensure it is correct.
  • In .github/workflows/tagpr-gh2changelog.yaml, you do not need to build tagpr; please use the version available on the Marketplace.
  • In tagpr-gh2changelog.yaml, set the TAGPR_CONFIG_FILE environment variable appropriately so that it correctly reads gh2changelog/.tagpr. @copilot

Co-authored-by: Songmu <177122+Songmu@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 14, 2026

  • Please use changelogFile instead of changelog in gh2changelog/.tagpr.
    • Check the tagpr implementation to confirm whether the file path should be relative to .tagpr or the repository roo...

All changes completed in commit d0a49b7:

  1. Changed changelog to changelogFile in gh2changelog/.tagpr

    • Verified this is the correct field name per config.go
    • Path is CHANGELOG.md, relative to the gh2changelog/ directory (where the .tagpr file is located)
    • The versionFile path (version.go) is also relative to gh2changelog/
  2. Updated workflow to use marketplace action

    • Replaced manual build/install with uses: Songmu/tagpr@v1
    • Removed Go setup step (no longer needed)
    • Simplified workflow from 4 steps to 3 steps
  3. Set TAGPR_CONFIG_FILE via config parameter

    • Added config: gh2changelog/.tagpr to the action
    • This sets the TAGPR_CONFIG_FILE environment variable to point to the subdirectory config
    • The action will run tagpr with the correct configuration for the gh2changelog submodule

Copilot AI requested a review from Songmu February 14, 2026 08:42
Copy link
Owner

@Songmu Songmu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Please ensure that tagpr.changelogFile and tagpr.versionFile are described as relative paths from the repository root.
  • Please use pinact to pin the version specification of tagpr within the workflow.
    @copilot

Co-authored-by: Songmu <177122+Songmu@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 14, 2026

  • Please ensure that tagpr.changelogFile and tagpr.versionFile are described as relative paths from the repository root.
  • Please use pinact to pin the version specification of tagpr within the wo...

Completed in commit 9160da5:

  1. Updated paths to be relative to repository root

    • Changed versionFile from version.go to gh2changelog/version.go
    • Changed changelogFile from CHANGELOG.md to gh2changelog/CHANGELOG.md
    • These paths are now resolved from the repository root when using config: gh2changelog/.tagpr
  2. Pinned tagpr action version

    • Changed from Songmu/tagpr@v1 to Songmu/tagpr@78a926ba835e34721053309043aee696ba9c70b1 # v1.15.0
    • Used the commit hash for v1.15.0 (the current default version in action.yml)
    • Consistent with other pinned actions in the repository

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/repos/Songmu/tagpr/commits/v1
    • Triggering command: /home/REDACTED/go/bin/pinact /home/REDACTED/go/bin/pinact run .github/workflows/tagpr-gh2changelog.yaml (http block)
  • https://api.github.com/repos/Songmu/tagpr/git/refs/tags/v1
    • Triggering command: /usr/bin/curl curl -s REDACTED /home/REDACTED/go/pkg/mod/github.com/urfave/cli/v2@v2.27.6/args.go (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI requested a review from Songmu February 14, 2026 08:54
@Songmu Songmu marked this pull request as ready for review February 14, 2026 08:59
@Songmu Songmu merged commit 8d80d15 into main Feb 14, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrate gh2changelog to monorepo management

2 participants