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