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,37 @@ jobs:
4237 run : |
4338 go install golang.org/x/tools/gopls@latest
4439
40+ - name : Checkout current branch
41+ uses : actions/checkout@v3
42+ with :
43+ fetch-depth : 0
44+
4545 - name : Setup Git
4646 run : |
4747 git config user.name "github-actions[bot]"
48- git config user.email "github-actions[bot]@users.noreply.github.com"
49-
50- - name : Get PR details
51- id : pr-details
52- 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
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+ generate-go-function-docs diff -b ${{ github.event.pull_request.base.sha }} -c ${{ github.event.pull_request.head.sha }} -g fake_slash
6860
6961 - name : Make sure code still compiles
7062 run : |
7163 go mod tidy
72- go mod vendor
7364 go build ./...
7465
7566 - name : Commit changes
7667 run : |
7768 git add .
7869 git commit -m "Add automatically generated go documentation"
79- git push origin ${{ steps.pr-details.outputs.pr_branch }}-docs
70+ git push origin ${{ github.event.pull_request.head.ref }}-docs
8071
8172 - name : Setup GitHub Token for creating a new PR
8273 id : setup-github-token-write
9081 uses : peter-evans/create-pull-request@v7
9182 with :
9283 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."
84+ base : ${{ github.event.pull_request.head.ref }}
85+ branch : ${{ github.event.pull_request.head.ref }}-docs
86+ title : " Go docs for PR#${{ github.event.pull_request.number }}"
87+ body : " This PR contains automatically generated go documentation for the PR#${{ github.event.pull_request.number }}. Please review the changes."
0 commit comments