@@ -16,23 +16,22 @@ jobs:
1616 contents : read
1717
1818 steps :
19- # - name: Setup GitHub Token for reading Generate Go Doc Repo
20- # id: setup-github-token-read
21- # uses: smartcontractkit/.github/actions/setup-github-token@9e7cc0779934cae4a9028b8588c9adb64d8ce68c # [email protected] 22- # with:
23- # aws-role-arn: ${{ secrets.AWS_ROLE_ARN_READ_GENERATE_GO_DOC_REPO }}
24- # aws-lambda-url: ${{ secrets.GATI_LAMBDA_TT_URL }}
25- # aws-region: ${{ secrets.AWS_REGION }}
19+ - name : Setup GitHub Token for reading Generate Go Doc Repo
20+ id : setup-github-token-read
21+ uses :
smartcontractkit/.github/actions/setup-github-token@9e7cc0779934cae4a9028b8588c9adb64d8ce68c # [email protected] 22+ with :
23+ aws-role-arn : ${{ secrets.AWS_ROLE_ARN_READ_GENERATE_GO_DOC_REPO }}
24+ aws-lambda-url : ${{ secrets.GATI_LAMBDA_TT_URL }}
25+ aws-region : ${{ secrets.AWS_REGION }}
2626
2727 - name : Configure git for private repository and install go tools
2828 env :
2929 GOPRIVATE : github.com/smartcontractkit/generate-go-function-docs
3030 run : |
31- # git config --global \
32- # url."https://x-access-token:${{ steps.setup-github-token-read.outputs.access-token }}@github.com/".insteadOf "https://github.com/"
33- # go install github.com/smartcontractkit/generate-go-function-docs@latest
31+ git config --global url."https://x-access-token:${{ steps.setup-github-token-read.outputs.access-token }}@github.com/".insteadOf "https://github.com/"
32+ go install github.com/smartcontractkit/generate-go-function-docs@latest
3433 go install github.com/jmank88/[email protected] 35- # go install golang.org/x/tools/gopls@latest
34+ go install golang.org/x/tools/gopls@latest
3635
3736 - name : Checkout current branch
3837 uses : actions/checkout@v3
6766 PATH=$PATH:$(go env GOPATH)/bin
6867 export PATH
6968
69+ # Find all go projects
7070 gomods_output=$(gomods 2>&1)
7171
7272 # Extract the parent directories of go.mod files
@@ -75,21 +75,12 @@ jobs:
7575 # Convert parent directories into a JSON matrix
7676 echo "$parent_folders" | jq -R -s 'split("\n") | map(select(length > 0)) | map({folder: .})' > all_folders.json
7777
78- echo "$FILTERS" > filters.json
79-
80- cat filters.json
81-
82- jq --argjson filters "$(cat filters.json)" 'map(select(.folder as $folder | $filters | index($folder)))' all_folders.json > filtered_folders.json
83-
84- echo "Full folder List JSON"
85- cat all_folders.json
78+ # Filter the directories that did not changeß
79+ jq --argjson filters "$FILTERS" 'map(select(.folder as $folder | $filters | index($folder)))' all_folders.json > filtered_folders.json
8680
8781 echo "Filtered folder List JSON"
8882 cat filtered_folders.json
8983
90- exit 1
91-
92- rm filters.json
9384 rm all_folders.json
9485
9586 - name : Generate go docs for changed projects
@@ -103,12 +94,18 @@ jobs:
10394 cat filtered_folders.json | jq -c '.[]' | while read -r item; do
10495 folder=$(echo "$item" | jq -r '.folder')
10596 echo "Processing folder: $folder"
106- generate-go-function-docs diff -b ${{ github.event.pull_request.base.sha }} -c ${{ github.event.pull_request.head.sha }} -g chatgpt -f "$folder"
97+ generate-go-function-docs diff -b ${{ github.event.pull_request.base.sha }} -c ${{ github.event.pull_request.head.sha }} --saveCosts --generator chatgpt --folder "$folder"
10798 cd "$folder"
10899 cd -
109100 done
110101 rm filtered_folders.json
111102
103+ - name : Save costs
104+ uses : actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
105+ with :
106+ name : generation-costs
107+ path : ./costs
108+
112109 - name : Setup GitHub Token for creating a new PR
113110 id : setup-github-token-write
114111 uses :
smartcontractkit/.github/actions/setup-github-token@9e7cc0779934cae4a9028b8588c9adb64d8ce68c # [email protected]
0 commit comments