英文:
GitHub Action to auto update Go import paths
问题
有一个名为"auto-update-imports"的GitHub Action可以自动打开一个PR,并将Go导入路径更新到新的主要版本。你可以在GitHub Marketplace上找到这个Action。它会检查你的代码库中的所有Go文件,并将导入路径从github.com/org/example/v1
更新为github.com/org/example/v2
。如果找不到这个Action,你可以尝试编写一个bash脚本来实现这个功能。希望对你有帮助!
英文:
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
得分: 0
我为此编写了一些自定义逻辑:https://github.com/osmosis-labs/osmosis/pull/2094
基本上,它有一个 bash 脚本,遍历所有文件并增加主版本号。
然后,一个自定义的 GA 工作流程从一个新分支运行该脚本,并对目标分支发起拉取请求。
英文:
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论