GitHub Action to auto update Go import paths

Viewed 28

Is there a GitHub action to auto-open a PR with Go import paths updated to a new major version?

For example, my module is module github.com/org/example/v1

and imports across the repo are import "github.com/org/example/v1/test".

I would like to run an action that will open a PR with all imports + the module updated to v2 like:

`import "github.com/org/example/v2/test"`

Is there one like that?

If not, does anyone have a bash script for doing this?

Thanks in advance!

1 Answers

I wrote some custom logic for this: https://github.com/osmosis-labs/osmosis/pull/2094

Basically, it has a bash script that goes over all files and increases the major version.

A custom GA workflow then runs the script from a new branch and opens a pull request against the target branch.

Related