Skip to content

Commit 795a3de

Browse files
committed
tidy
1 parent 0b5962e commit 795a3de

File tree

1 file changed

+62
-10
lines changed

1 file changed

+62
-10
lines changed

.github/workflows/mod-tidy.yml

Lines changed: 62 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,74 @@ on:
77
- '**.md' # Ignore markdown files changes
88

99
jobs:
10+
dump_contexts_to_log:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Dump GitHub context
14+
env:
15+
GITHUB_CONTEXT: ${{ toJson(github) }}
16+
run: echo "$GITHUB_CONTEXT"
17+
- name: Dump job context
18+
env:
19+
JOB_CONTEXT: ${{ toJson(job) }}
20+
run: echo "$JOB_CONTEXT"
21+
- name: Dump steps context
22+
env:
23+
STEPS_CONTEXT: ${{ toJson(steps) }}
24+
run: echo "$STEPS_CONTEXT"
25+
- name: Dump runner context
26+
env:
27+
RUNNER_CONTEXT: ${{ toJson(runner) }}
28+
run: echo "$RUNNER_CONTEXT"
29+
- name: Dump strategy context
30+
env:
31+
STRATEGY_CONTEXT: ${{ toJson(strategy) }}
32+
run: echo "$STRATEGY_CONTEXT"
33+
- name: Dump matrix context
34+
env:
35+
MATRIX_CONTEXT: ${{ toJson(matrix) }}
36+
run: echo "$MATRIX_CONTEXT"
1037
tidy:
38+
name: ${{ matrix.working-directory }} tidy
39+
strategy:
40+
matrix:
41+
include: [ { working-directory: "." } ]
1142
runs-on: ubuntu-latest
1243
steps:
13-
- name: Check out code
14-
uses: actions/checkout@v2
15-
44+
- name: Dump job context
45+
env:
46+
JOB_CONTEXT: ${{ toJson(job) }}
47+
run: echo "$JOB_CONTEXT"
48+
- name: Dump strategy context
49+
env:
50+
STRATEGY_CONTEXT: ${{ toJson(strategy) }}
51+
run: echo "$STRATEGY_CONTEXT"
52+
- name: Dump matrix context
53+
env:
54+
MATRIX_CONTEXT: ${{ toJson(matrix) }}
55+
run: echo "$MATRIX_CONTEXT"
56+
- name: Checkout
57+
uses: actions/checkout@v4
58+
with:
59+
fetch-depth: 0
1660
- name: Set up Go
17-
uses: actions/setup-go@v2
61+
uses: actions/setup-go@v4
1862
with:
19-
go-version: '1.18' # Specify the Go version
20-
21-
- name: Tidy Go modules
22-
run: go mod tidy
63+
go-version-file: "${{ matrix.working-directory }}/go.work"
64+
check-latest: true
65+
cache-dependency-path: "${{ matrix.working-directory }}/go.work.sum"
2366

24-
- name: Generate Go files
25-
run: go generate ./...
67+
- name: Tidy Go modules in multiple directories
68+
run: |
69+
dirs=("src/graph")
70+
for dir in "${dirs[@]}"; do
71+
if [[ -d "$dir" && -f "$dir/go.mod" ]]; then
72+
echo "Running go mod tidy in $dir"
73+
(cd "$dir" && go mod tidy)
74+
else
75+
echo "Skipping $dir as it does not contain a go.mod file."
76+
fi
77+
done
2678
2779
- name: Auto commit changes
2880
uses: stefanzweifel/git-auto-commit-action@v4

0 commit comments

Comments
 (0)