Skip to content

Commit a723138

Browse files
committed
try to find relevant changes
1 parent 92afb4e commit a723138

File tree

1 file changed

+33
-5
lines changed

1 file changed

+33
-5
lines changed

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

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,24 +39,52 @@ jobs:
3939
with:
4040
fetch-depth: 0
4141

42+
- name: Detect changes
43+
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
44+
id: changes
45+
with:
46+
filters: |
47+
seth:
48+
- 'seth/**/*.go'
49+
wasp:
50+
- 'wasp/**/*.go'
51+
havoc:
52+
- 'havoc/**/*.go'
53+
lib:
54+
- 'lib/**/*.go'
55+
k8s-test-runner:
56+
- 'k8s-test-runner/**/*.go'
57+
framework:
58+
- 'framework/**/*.go'
59+
# later add tools here or make this filter dynamic (if possible)
60+
4261
- name: Find all go modules
4362
shell: bash
4463
id: go-modules
4564
run: |
4665
PATH=$PATH:$(go env GOPATH)/bin
47-
export PATH
66+
export PATH
67+
4868
gomods_output=$(gomods 2>&1)
4969
5070
# Extract the parent directories of go.mod files
5171
parent_folders=$(echo "$gomods_output" | grep 'go\.mod$' | sed 's/\/go\.mod//' | sed 's/^[ \t]*//;s/[ \t]*$//' | xargs -n 1)
5272
5373
# Convert parent directories into a JSON matrix
54-
echo "$parent_folders" | jq -R -s 'split("\n") | map(select(length > 0)) | map({folder: .})' > folders.json
74+
echo "$parent_folders" | jq -R -s 'split("\n") | map(select(length > 0)) | map({folder: .})' > all_folders.json
75+
76+
# Filter the folders based on the changes in the PR
77+
cat all_folders.json | jq --argjson filters "${{ steps.changes.outputs.changes }}" 'map(select(.folder as $f | $filters | any(. == ($f | split("/")[0]))))' > filtered_folders.json
78+
79+
echo "Full folder List JSON"
80+
cat all_folders.json
81+
82+
echo "Filtered folder List JSON"
83+
cat filtered_folders.json
5584
56-
echo "Folder List JSON"
57-
cat folders.json
85+
exit 1
5886
59-
- name: Generate go docs for all projects
87+
- name: Generate go docs for changed projects
6088
shell: bash
6189
env:
6290
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}

0 commit comments

Comments
 (0)