diff --git a/.github/workflows/import_paths.yml b/.github/workflows/import_paths.yml index 0af5f0c0379..bf6ea8ec420 100644 --- a/.github/workflows/import_paths.yml +++ b/.github/workflows/import_paths.yml @@ -57,21 +57,17 @@ jobs: - name: Run find & replace script run: ./scripts/replace_import_paths.sh ${{ inputs.version }} - - name: Commit and push changes - uses: devops-infra/action-commit-push@master + - name: Create Pull Request + uses: peter-evans/create-pull-request@v4 with: - github_token: ${{ secrets.GITHUB_TOKEN }} - commit_message: "auto: update Go import paths to v${{ inputs.version }}" - target_branch: update-paths - - name: Open PR - uses: devops-infra/action-pull-request@v0.5.0 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - title: ${{ github.event.commits[0].message }} - source_branch: ${{ inputs.source-branch }} - target_branch: ${{ inputs.target-branch }} - assignee: ${{ github.actor }} - draft: true - label: T:auto,T:code-hygiene + token: ${{ secrets.ADD_TO_PROJECT_PAT }} + title: "auto: update Go import paths to v${{ inputs.version }}" + commit-message: "auto: update Go import paths to v${{ inputs.version }}" body: "**Automated pull request**\n\nUpdating Go import paths to v${{ inputs.version }}" - get_diff: true + base: ${{ inputs.target-branch }} + branch-suffix: random + branch: ${{ inputs.source-branch }} + delete-branch: true + assignees: ${{ github.actor }} + draft: true + labels: T:auto,T:code-hygiene diff --git a/scripts/replace_import_paths.sh b/scripts/replace_import_paths.sh index 45ef110daf2..7211bfb5534 100755 --- a/scripts/replace_import_paths.sh +++ b/scripts/replace_import_paths.sh @@ -1,5 +1,7 @@ #!/bin/bash +set -euo pipefail + NEXT_MAJOR_VERSION=$1 import_path_to_replace=$(go list -m) @@ -15,7 +17,7 @@ replace_paths() { sed -i "s/github.com\/osmosis-labs\/osmosis\/v${version_to_replace}/github.com\/osmosis-labs\/osmosis\/v${NEXT_MAJOR_VERSION}/g" ${file} } -# Replace all files within Go packages. +echo "Replacing import paths in Go files" for mod in $modules; do for file in $mod/*; do @@ -25,6 +27,20 @@ do done done -replace_paths "go.mod" +echo "Replacing import paths in proto files" +for file in $(find proto/osmosis -type f -name "*.proto"); do + replace_paths $file +done +# protocgen.sh +replace_paths "scripts/protocgen.sh" + +echo "Updating go.mod and vendoring" +# go.mod +replace_paths "go.mod" go mod vendor >/dev/null + +echo "running make proto-gen" +# ensure protos match generated Go files +# N.B.: This must be run after go mod vendor. +make proto-gen >/dev/null