Skip to content

Commit 3e0c763

Browse files
committed
post comment with link to PR with docs + make gpt model configurable
1 parent aee82bd commit 3e0c763

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

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

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ jobs:
9494
cat filtered_folders.json | jq -c '.[]' | while read -r item; do
9595
folder=$(echo "$item" | jq -r '.folder')
9696
echo "Processing folder: $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"
97+
generate-go-function-docs diff -b ${{ github.event.pull_request.base.sha }} -c ${{ github.event.pull_request.head.sha }} --saveCosts --generator chatgpt --generatorSubType ${{ vars.GO_DOC_GEN_CHATGPT_MODEL }}--folder "$folder"
9898
cd "$folder"
9999
cd -
100100
done
@@ -120,6 +120,7 @@ jobs:
120120

121121
- name: Create a new PR targeting current PR
122122
uses: peter-evans/create-pull-request@5e914681df9dc83aa4e4905692ca88beb2f9e91f # v7.0.5
123+
id: create-pr
123124
with:
124125
token: ${{ steps.setup-github-token-write.outputs.access-token }}
125126
branch: ${{ github.head_ref }}-docs
@@ -128,6 +129,25 @@ jobs:
128129
body: "This PR contains automatically generated go documentation for the PR#${{ github.event.pull_request.number }}. Please review the changes."
129130
commit-message: "[Bot] Add automatically generated go documentation"
130131

132+
- name: Find comment with PR link
133+
uses: peter-evans/find-comment@3eae4d37986fb5a8592848f6a574fdf654e61f9e # v3.1.0
134+
id: fc
135+
with:
136+
issue-number: ${{ github.event.pull_request.number }}
137+
comment-author: 'github-actions[bot]'
138+
body-includes: Go doc generation
139+
140+
- name: Create comment in the original PR
141+
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
142+
if: ${{ steps.fc.outputs.comment-id }} == ''
143+
with:
144+
token: ${{ steps.setup-github-token-write.outputs.access-token }}
145+
issue-number: ${{ github.event.pull_request.number }}
146+
body: |
147+
## Go doc generation
148+
Hey @${{ github.actor }}, you can check generated Go function generation [here](${{ steps.create-pr.outputs.pull-request-url }}).
149+
Please review them and merge to this PR once you're satisfied with them.
150+
131151
- name: Send Slack notification
132152
uses: slackapi/slack-github-action@6c661ce58804a1a20f6dc5fbee7f0381b469e001 # v1.25.0
133153
if: failure()

0 commit comments

Comments
 (0)