Skip to content

Commit 634ce9d

Browse files
authored
[TT-1725] go doc enhancements vol 2 (add tools, better comment in PR) (#1466)
1 parent 404e04e commit 634ce9d

File tree

1 file changed

+46
-11
lines changed

1 file changed

+46
-11
lines changed

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

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

1010
jobs:
1111
generate_docs_new_pr:
12-
if: ${{ contains(github.event.pull_request.labels.*.name, 'generate_go_docs') }}
12+
name: Generate Go Docs
13+
if: ${{ contains(github.event.pull_request.labels.*.name, 'generate_go_docs') }}
1314
runs-on: ubuntu-latest
1415
environment: integration
1516
permissions:
1617
id-token: write
17-
contents: read
18+
contents: read
1819

1920
steps:
2021
- name: Setup GitHub Token for reading Generate Go Doc Repo
@@ -56,18 +57,38 @@ jobs:
5657
- 'k8s-test-runner/**/*.go'
5758
framework:
5859
- 'framework/**/*.go'
60+
tools/asciitable:
61+
- 'tools/asciitable/**/*.go'
62+
tools/breakingchanges:
63+
- 'tools/breakingchanges/**/*.go'
64+
tools/citool:
65+
- 'tools/citool/**/*.go'
66+
tools/ecrimagefetcher:
67+
- 'tools/ecrimagefetcher/**/*.go'
68+
tools/envresolve:
69+
- 'tools/envresolve/**/*.go'
5970
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
71+
- 'tools/flakeguard/**/*.go'
72+
tools/ghlatestreleasechecker:
73+
- 'tools/ghlatestreleasechecker/**/*.go'
74+
tools/ghsecrets:
75+
- 'tools/ghsecrets/**/*.go'
76+
tools/gotestloghelper:
77+
- 'tools/gotestloghelper/**/*.go'
78+
tools/testlistgenerator:
79+
- 'tools/testlistgenerator/**/*.go'
80+
tools/workflowresultparser:
81+
- 'tools/workflowresultparser/**/*.go'
82+
# add more projects here
6283
6384
- name: Find all go modules in the repository and filter the ones that changed
6485
shell: bash
6586
id: go-modules
6687
env:
67-
FILTERS: ${{ steps.changes.outputs.changes }}
88+
FILTERS: ${{ steps.changes.outputs.changes }}
6889
run: |
6990
PATH=$PATH:$(go env GOPATH)/bin
70-
export PATH
91+
export PATH
7192
7293
# Find all go projects
7394
gomods_output=$(gomods 2>&1)
@@ -117,7 +138,7 @@ jobs:
117138
with:
118139
aws-role-arn: ${{ secrets.AWS_ROLE_ARN_CREATE_PR }}
119140
aws-lambda-url: ${{ secrets.GATI_LAMBDA_TT_URL }}
120-
aws-region: ${{ secrets.AWS_REGION }}
141+
aws-region: ${{ secrets.AWS_REGION }}
121142

122143
- name: Create a new PR targeting current PR
123144
uses: peter-evans/create-pull-request@5e914681df9dc83aa4e4905692ca88beb2f9e91f # v7.0.5
@@ -137,19 +158,33 @@ jobs:
137158
issue-number: ${{ github.event.pull_request.number }}
138159
body-includes: Go doc generation
139160

140-
- name: Create comment in the original PR
161+
- name: Create comment in the original PR with link to the new PR
141162
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
142-
if: steps.fc.outputs.comment-id == 0
163+
if: steps.create-pr.outputs.pull-request-number != ''
143164
with:
144165
token: ${{ steps.setup-github-token-write.outputs.access-token }}
145166
issue-number: ${{ github.event.pull_request.number }}
167+
comment-id: ${{ steps.fc.outputs.comment-id }}
168+
edit-mode: replace
146169
body: |
147170
## Go doc generation
148171
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.
149172
173+
- name: Create comment in the original PR to notify about no new docs
174+
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
175+
if: steps.create-pr.outputs.pull-request-number == ''
176+
with:
177+
token: ${{ steps.setup-github-token-write.outputs.access-token }}
178+
issue-number: ${{ github.event.pull_request.number }}
179+
comment-id: ${{ steps.fc.outputs.comment-id }}
180+
edit-mode: replace
181+
body: |
182+
## Go doc generation
183+
Hey @${{ github.actor }}, no documentation was generated. Are you sure that you made changes to public functions without existing comments in your PR?
184+
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)