2424 aws-lambda-url : ${{ secrets.GATI_LAMBDA_TT_URL }}
2525 aws-region : ${{ secrets.AWS_REGION }}
2626
27- - name : Checkout current branch
28- uses : actions/checkout@v3
29- with :
30- fetch-depth : 0
31-
3227 - name : Configure git for private repository and install go doc generator
3328 env :
3429 GOPRIVATE : github.com/smartcontractkit/generate-go-function-docs
@@ -42,41 +37,40 @@ jobs:
4237 run : |
4338 go install golang.org/x/tools/gopls@latest
4439
45- - name : Setup Git
46- run : |
47- git config user.name "github-actions[bot]"
48- git config user.email "github-actions[bot]@users.noreply.github.com"
40+ - name : Checkout current branch
41+ uses : actions/checkout@v3
42+ with :
43+ fetch-depth : 0
4944
50- - name : Get PR details
51- id : pr-details
45+ - name : Setup Git to use GitHub Actions bot
5246 run : |
53- echo "pr_number=$(jq -r .pull_request.number <<< "$GITHUB_EVENT_PATH")" >> $GITHUB_OUTPUT
54- echo "pr_branch=$(jq -r .pull_request.head.ref <<< "$GITHUB_EVENT_PATH")" >> $GITHUB_OUTPUT
55- echo "base_commit=${{ github.event.pull_request.base.sha }}" >> $GITHUB_OUTPUT
56- echo "head_commit=${{ github.event.pull_request.head.sha }}" >> $GITHUB_OUTPUT
47+ git config user.name "github-actions[bot]"
48+ git config user.email "github-actions[bot]@users.noreply.github.com"
5749
5850 - name : Create a new branch
5951 run : |
60- git checkout -b ${{ steps.pr-details.outputs.pr_branch }}-docs
52+ git checkout -b ${{ github.event.pull_request.head.ref }}-docs
6153
6254 - name : Generate go docs
6355 shell : bash
6456 env :
6557 OPENAI_API_KEY : ${{ secrets.OPENAI_API_KEY }}
6658 run : |
67- generate-go-function-docs diff -b ${{ steps.pr-details.outputs.base_commit }} -c ${{ steps.pr-details.outputs.head_commit }} -g fake_slash
59+ # Add go binary to PATH
60+ PATH=$PATH:$(go env GOPATH)/bin
61+ export PATH
62+ generate-go-function-docs diff -b ${{ github.event.pull_request.base.sha }} -c ${{ github.event.pull_request.head.sha }} -g fake_slash
6863
6964 - name : Make sure code still compiles
7065 run : |
7166 go mod tidy
72- go mod vendor
7367 go build ./...
7468
7569 - name : Commit changes
7670 run : |
7771 git add .
7872 git commit -m "Add automatically generated go documentation"
79- git push origin ${{ steps.pr-details.outputs.pr_branch }}-docs
73+ git push origin ${{ github.event.pull_request.head.ref }}-docs
8074
8175 - name : Setup GitHub Token for creating a new PR
8276 id : setup-github-token-write
9084 uses : peter-evans/create-pull-request@v7
9185 with :
9286 token : ${{ secrets.GITHUB_TOKEN }}
93- base : ${{ env.pr_branch }}
94- branch : ${{ steps.pr-details.outputs.pr_branch }}-docs
95- title : " Go docs for PR#${{ env.pr_number }}"
96- body : " This PR contains automatically generated go documentation for the PR#${{ env.pr_number }}. Please review the changes."
87+ base : ${{ github.event.pull_request.head.ref }}
88+ branch : ${{ github.event.pull_request.head.ref }}-docs
89+ title : " Go docs for PR#${{ github.event.pull_request.number }}"
90+ body : " This PR contains automatically generated go documentation for the PR#${{ github.event.pull_request.number }}. Please review the changes."
0 commit comments