Skip to content

Commit a45dd6b

Browse files
committed
run generation for seth
1 parent 8b678de commit a45dd6b

File tree

1 file changed

+36
-9
lines changed

1 file changed

+36
-9
lines changed

.github/workflows/generate-go-docs.yaml

Lines changed: 36 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -60,32 +60,59 @@ 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+
106+
- name: Fetch repository changes
107+
uses: actions/checkout@v3
108+
with:
109+
fetch-depth: 0
110+
84111
- name: Create a new PR targeting current PR
85112
uses: peter-evans/create-pull-request@v7
86113
with:
87-
token: ${{ secrets.GITHUB_TOKEN }}
88-
base: ${{ github.event.pull_request.head.ref }}
89-
branch: ${{ github.event.pull_request.head.ref }}-docs
114+
token: ${{ steps.setup-github-token-write.outputs.access-token }}
115+
base: ${{ steps.branch-names.outputs.base_branch }}
116+
branch: ${{ steps.branch-names.outputs.new_branch }}
90117
title: "Go docs for PR#${{ github.event.pull_request.number }}"
91118
body: "This PR contains automatically generated go documentation for the PR#${{ github.event.pull_request.number }}. Please review the changes."

0 commit comments

Comments
 (0)