-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathupdate-submodule-dependencies.yaml
More file actions
132 lines (109 loc) · 4.85 KB
/
Copy pathupdate-submodule-dependencies.yaml
File metadata and controls
132 lines (109 loc) · 4.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
name: Update Submodule Dependencies
on:
push:
branches: [main]
# Only run if changes affect the root module (not submodules themselves)
paths-ignore:
- "cmd/openapi/**"
- "openapi/linter/customrules/**"
- "openapi/linter/converter/tests/**"
- ".github/workflows/update-submodule-dependencies.yaml"
permissions:
contents: write
pull-requests: write
jobs:
update-dependencies:
name: Update submodule dependencies
runs-on: ubuntu-latest
env:
GOTOOLCHAIN: local
steps:
- uses: actions/checkout@v6
- name: Setup Go
uses: actions/setup-go@v6
with:
go-version-file: "go.work"
cache: false # Disable caching to ensure fresh dependency resolution
- name: Update openapi/linter/customrules go.mod
run: |
cd openapi/linter/customrules
# Update to latest main commit (GOPROXY=direct needed to resolve @main before proxy indexes it)
GOPROXY=direct go get github.com/speakeasy-api/openapi@main
go mod tidy
- name: Update openapi/linter/converter/tests go.mod
run: |
cd openapi/linter/converter/tests
# Update to latest main commit (both main module and customrules)
GOPROXY=direct go get github.com/speakeasy-api/openapi@main
GOPROXY=direct go get github.com/speakeasy-api/openapi/openapi/linter/customrules@main
go mod tidy
- name: Update cmd/openapi go.mod
run: |
cd cmd/openapi
# Update to latest main commit (both main module and customrules)
GOPROXY=direct go get github.com/speakeasy-api/openapi@main
GOPROXY=direct go get github.com/speakeasy-api/openapi/openapi/linter/customrules@main
go mod tidy
- name: Check for changes
id: changes
run: |
CHANGED_FILES=""
# Check customrules module
if ! git diff --quiet openapi/linter/customrules/go.mod openapi/linter/customrules/go.sum 2>/dev/null; then
CHANGED_FILES="${CHANGED_FILES}customrules "
fi
# Check converter/tests module
if ! git diff --quiet openapi/linter/converter/tests/go.mod openapi/linter/converter/tests/go.sum 2>/dev/null; then
CHANGED_FILES="${CHANGED_FILES}converter-tests "
fi
# Check cmd/openapi module
if ! git diff --quiet cmd/openapi/go.mod cmd/openapi/go.sum 2>/dev/null; then
CHANGED_FILES="${CHANGED_FILES}cmd "
fi
if [ -z "$CHANGED_FILES" ]; then
echo "changed=false" >> $GITHUB_OUTPUT
echo "No changes detected"
else
echo "changed=true" >> $GITHUB_OUTPUT
echo "modules=${CHANGED_FILES}" >> $GITHUB_OUTPUT
echo "Changes detected in: ${CHANGED_FILES}"
# Get the new version for the PR description
NEW_VERSION=$(grep 'github.com/speakeasy-api/openapi v' cmd/openapi/go.mod | head -1 | awk '{print $2}')
echo "version=${NEW_VERSION}" >> $GITHUB_OUTPUT
echo "Updated to version: ${NEW_VERSION}"
fi
- name: Create Pull Request
if: steps.changes.outputs.changed == 'true'
uses: peter-evans/create-pull-request@v8
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: |
chore: update submodule dependencies to latest main
Updates go.mod files in submodules to use the latest commit from main.
Version: ${{ steps.changes.outputs.version }}
Updated modules: ${{ steps.changes.outputs.modules }}
branch: bot/update-submodule-dependencies
delete-branch: true
title: "chore: update submodule dependencies to latest main"
body: |
## Updates submodule dependencies
This PR updates the `go.mod` files in submodules to reference the latest commit from main.
**Updated to:** `${{ steps.changes.outputs.version }}`
**Updated modules:** ${{ steps.changes.outputs.modules }}
**Changes:**
- Updated `github.com/speakeasy-api/openapi` dependency in submodule go.mod files
- Ran `go mod tidy` to update dependencies
---
*This PR was automatically created by the [update-submodule-dependencies workflow](.github/workflows/update-submodule-dependencies.yaml)*
labels: |
dependencies
automated
- name: Summary
run: |
if [ "${{ steps.changes.outputs.changed }}" == "true" ]; then
echo "✅ Pull request created to update submodule dependencies"
echo "Version: ${{ steps.changes.outputs.version }}"
echo "Modules: ${{ steps.changes.outputs.modules }}"
else
echo "ℹ️ No changes needed - submodule dependencies already up to date"
fi