Skip to content

Commit 09aa358

Browse files
committed
add support for all tools, post a different comments if no doc was generated
1 parent 404e04e commit 09aa358

File tree

1 file changed

+48
-13
lines changed

1 file changed

+48
-13
lines changed

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

Lines changed: 48 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ on:
99

1010
jobs:
1111
generate_docs_new_pr:
12-
if: ${{ contains(github.event.pull_request.labels.*.name, 'generate_go_docs') }}
12+
if: ${{ contains(github.event.pull_request.labels.*.name, 'generate_go_docs') }}
1313
runs-on: ubuntu-latest
1414
environment: integration
1515
permissions:
1616
id-token: write
17-
contents: read
17+
contents: read
1818

1919
steps:
2020
- name: Setup GitHub Token for reading Generate Go Doc Repo
@@ -56,18 +56,38 @@ jobs:
5656
- 'k8s-test-runner/**/*.go'
5757
framework:
5858
- 'framework/**/*.go'
59+
tools/asciitable:
60+
- 'tools/asciitable/**/*.go'
61+
tools/breakingchanges:
62+
- 'tools/breakingchanges/**/*.go'
63+
tools/citool:
64+
- 'tools/citool/**/*.go'
65+
tools/ecrimagefetcher:
66+
- 'tools/ecrimagefetcher/**/*.go'
67+
tools/envresolve:
68+
- 'tools/envresolve/**/*.go'
5969
tools/flakeguard:
60-
- 'tools/flakeguard/**/*.go'
61-
# later add tools here or, if possible, make this filter dynamic so that it's created based on the go modules in the repository
70+
- 'tools/flakeguard/**/*.go'
71+
tools/ghlatestreleasechecker:
72+
- 'tools/ghlatestreleasechecker/**/*.go'
73+
tools/ghsecrets:
74+
- 'tools/ghsecrets/**/*.go'
75+
tools/gotestloghelper:
76+
- 'tools/gotestloghelper/**/*.go'
77+
tools/testlistgenerator:
78+
- 'tools/testlistgenerator/**/*.go'
79+
tools/workflowresultparser:
80+
- 'tools/workflowresultparser/**/*.go'
81+
# add more projects here
6282
6383
- name: Find all go modules in the repository and filter the ones that changed
6484
shell: bash
6585
id: go-modules
6686
env:
67-
FILTERS: ${{ steps.changes.outputs.changes }}
87+
FILTERS: ${{ steps.changes.outputs.changes }}
6888
run: |
6989
PATH=$PATH:$(go env GOPATH)/bin
70-
export PATH
90+
export PATH
7191
7292
# Find all go projects
7393
gomods_output=$(gomods 2>&1)
@@ -117,7 +137,7 @@ jobs:
117137
with:
118138
aws-role-arn: ${{ secrets.AWS_ROLE_ARN_CREATE_PR }}
119139
aws-lambda-url: ${{ secrets.GATI_LAMBDA_TT_URL }}
120-
aws-region: ${{ secrets.AWS_REGION }}
140+
aws-region: ${{ secrets.AWS_REGION }}
121141

122142
- name: Create a new PR targeting current PR
123143
uses: peter-evans/create-pull-request@5e914681df9dc83aa4e4905692ca88beb2f9e91f # v7.0.5
@@ -137,19 +157,34 @@ jobs:
137157
issue-number: ${{ github.event.pull_request.number }}
138158
body-includes: Go doc generation
139159

140-
- name: Create comment in the original PR
160+
- name: Create comment in the original PR with link to the new PR
161+
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
162+
if: steps.create-pr.outputs.pull-request-url != github.event.pull_request.number
163+
with:
164+
token: ${{ steps.setup-github-token-write.outputs.access-token }}
165+
issue-number: ${{ github.event.pull_request.number }}
166+
comment-id: ${{ steps.fc.outputs.comment-id }}
167+
edit-mode: replace
168+
body: |
169+
echo "## Go doc generation"
170+
echo "Hey @${{ github.actor }}, you can check generated Go function documentation [here](${{ steps.create-pr.outputs.pull-request-url }}). Please review them and merge to this PR once you're satisfied with them."
171+
172+
173+
- name: Create comment in the original PR to notify about no new docs
141174
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
142-
if: steps.fc.outputs.comment-id == 0
175+
if: steps.create-pr.outputs.pull-request-url == github.event.pull_request.number
143176
with:
144177
token: ${{ steps.setup-github-token-write.outputs.access-token }}
145178
issue-number: ${{ github.event.pull_request.number }}
179+
comment-id: ${{ steps.fc.outputs.comment-id }}
180+
edit-mode: replace
146181
body: |
147-
## Go doc generation
148-
Hey @${{ github.actor }}, you can check generated Go function documentation [here](${{ steps.create-pr.outputs.pull-request-url }}). Please review them and merge to this PR once you're satisfied with them.
182+
echo "## Go doc generation"
183+
echo "Hey @${{ github.actor }}, no documentation was generated. Are you sure that you made changes to public functions without existing comments in your PR?"
149184
150185
- name: Send Slack notification
151186
uses: slackapi/slack-github-action@6c661ce58804a1a20f6dc5fbee7f0381b469e001 # v1.25.0
152-
if: failure()
187+
if: failure()
153188
id: slack
154189
env:
155190
SLACK_BOT_TOKEN: ${{ secrets.QA_SLACK_API_KEY }}
@@ -174,7 +209,7 @@ jobs:
174209
"type": "mrkdwn",
175210
"text": "<@U060CGGPY8H>, please have a look."
176211
}
177-
},
212+
},
178213
{
179214
"type": "section",
180215
"text": {

0 commit comments

Comments
 (0)