@@ -60,32 +60,54 @@ jobs:
6060 PATH=$PATH:$(go env GOPATH)/bin
6161 export PATH
6262 # TODO check why this flag is needed, if it has a default!
63- generate-go-function-docs diff -b ${{ github.event.pull_request.base.sha }} -c ${{ github.event.pull_request.head.sha }} -g fake_slash -f .
63+ # TODO we need a way to determine which modules have changes and run this command for all of them
64+ generate-go-function-docs diff -b ${{ github.event.pull_request.base.sha }} -c ${{ github.event.pull_request.head.sha }} -g fake_slash -f ./seth --goModLocation ./seth/go.mod
6465
6566 - name : Make sure code still compiles
6667 run : |
68+ # TODO we need a way to determine which modules have changes and run this command for all of them
69+ cd seth
6770 go mod tidy
6871 go build ./...
6972
70- - name : Commit changes
73+ - name : Setup branch names
74+ id : branch-names
75+ shell : bash
7176 run : |
72- git add .
73- git commit -m "Add automatically generated go documentation"
74- git push origin ${{ github.event.pull_request.head.ref }}-docs
77+ echo "base_branch=${{ github.head_ref }}" >> $GITHUB_OUTPUT
78+ echo "new_branch=${{ github.head_ref }}-docs" >> $GITHUB_OUTPUT
7579
7680 - name : Setup GitHub Token for creating a new PR
7781 id : setup-github-token-write
7882 uses :
smartcontractkit/.github/actions/setup-github-token@9e7cc0779934cae4a9028b8588c9adb64d8ce68c # [email protected] 7983 with :
80- aws-role-arn : ${{ secrets.AWS_ROLE_ARN_READ_GENERATE_GO_DOC_REPO }}
84+ aws-role-arn : ${{ secrets.AWS_ROLE_ARN_CREATE_PR }}
8185 aws-lambda-url : ${{ secrets.GATI_LAMBDA_TT_URL }}
8286 aws-region : ${{ secrets.AWS_REGION }}
8387
88+ - name : Checkout new branch
89+ uses : peterjgrainger/action-create-branch@10c7d268152480ae859347db45dc69086cef1d9c # v3.0.0
90+ env :
91+ GITHUB_TOKEN : ${{ steps.setup-github-token-write.outputs.access-token }}
92+ with :
93+ branch : ${{ steps.branch-names.outputs.new_branch }}
94+
95+ - name : Commit changes
96+ uses : planetscale/ghcommit-action@13a844326508cdefc72235201bb0446d6d10a85f # v0.1.6
97+ with :
98+ commit_message : " [Bot] Add automatically generated go documentation"
99+ repo : ${{ github.repository }}
100+ branch : ${{ steps.branch-names.outputs.new_branch }}
101+ # TODO we need a way to determine which modules have changes and run this command for all of them
102+ file_pattern : " seth/*"
103+ env :
104+ GITHUB_TOKEN : ${{ steps.setup-github-token-write.outputs.access-token }}
105+
84106 - name : Create a new PR targeting current PR
85107 uses : peter-evans/create-pull-request@v7
86108 with :
87- token : ${{ secrets.GITHUB_TOKEN }}
88- base : ${{ github.event.pull_request.head.ref }}
89- branch : ${{ github.event.pull_request.head.ref }}-docs
109+ token : ${{ steps.setup-github-token-write.outputs.access-token }}
110+ base : ${{ steps.branch-names.outputs.base_branch }}
111+ branch : ${{ steps.branch-names.outputs.new_branch }}
90112 title : " Go docs for PR#${{ github.event.pull_request.number }}"
91113 body : " This PR contains automatically generated go documentation for the PR#${{ github.event.pull_request.number }}. Please review the changes."
0 commit comments