Skip to content

Commit 0ceb71c

Browse files
committed
fixes #70
Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
1 parent b9394d8 commit 0ceb71c

3 files changed

Lines changed: 50 additions & 3 deletions

File tree

.github/workflows/bump-release-monorepo.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,9 +198,11 @@ jobs:
198198
steps:
199199
-
200200
name: Checkout repository
201+
if: ${{ needs.prepare-modules.outputs.pull-request-operation != 'none' }} # skip if no pull request to be waited
201202
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
202203
-
203204
name: Wait for PR to be merged
205+
if: ${{ needs.prepare-modules.outputs.pull-request-operation != 'none' }} # skip if no pull request to be waited
204206
run: |
205207
echo "::notice title=waiting-for-merge::Waiting for PR ${PR_URL} to be merged"
206208
@@ -227,6 +229,15 @@ jobs:
227229
228230
echo "::error title=timeout::Timed out waiting for PR to be merged after ${MAX_WAIT}s"
229231
exit 1
232+
-
233+
name: Report status
234+
run: |
235+
echo "::notice title=waiting-for-merge::Waiting for PR ${PR_URL} to be merged"
236+
if [[ "${{ needs.prepare-modules.outputs.pull-request-operation }}" == "none" ]] ; then
237+
echo "::notice title=wait-for-pr::no pull request expected. Skipped waiting."
238+
else
239+
echo "::notice title=wait-for-pr::pull request merged. Can proceed with the tagging and release"
240+
fi
230241
231242
tag-release-monorepo:
232243
name: Tag release [mono-repo]
@@ -282,6 +293,8 @@ jobs:
282293
MODULE_RELATIVE_NAMES: ${{ needs.detect-modules.outputs.bash-relative-names }}
283294
GITHUB_REPO: ${{ github.repository }}
284295
run: |
296+
set -x
297+
285298
# Tag all modules similar to hack/tag_modules.sh
286299
# Note: The PR with updated go.mod files has been merged at this point
287300
root="$(git rev-parse --show-toplevel)"
@@ -307,7 +320,7 @@ jobs:
307320
declare -a ALL_RELATIVE_MODULES
308321
mapfile -d' ' -t ALL_RELATIVE_MODULES < <(printf "%s" "${MODULE_RELATIVE_NAMES}")
309322
for module_relative_name in "${ALL_RELATIVE_MODULES[@]}"; do
310-
module_relative_name=${module_relative_name#"${GITHUB_REPO}"}
323+
module_relative_name=${module_relative_name#"${GITHUB_REPO}"} # in some case, the module is not prefixed by the root module, e.g. "v2" modules.
311324
if [[ -z "${module_relative_name}" || "${module_relative_name}" == "{root}" ]] ; then
312325
module_tag="${NEXT_TAG}" # e.g. "v0.24.0"
313326
else

.github/workflows/contributors.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ jobs:
6565
runs-on: ubuntu-latest
6666
outputs:
6767
pull-request-url: ${{ steps.create-pull-request.outputs.pull-request-url }}
68+
pull-request-operation: ${{ steps.create-pull-request.outputs.pull-request-operation }}
6869
steps:
6970
-
7071
name: Checkout repository
@@ -116,6 +117,18 @@ jobs:
116117
sign-commits: ${{ inputs.enable-commit-signing }}
117118
signoff: true # DCO
118119

120+
no-change:
121+
needs: [update-contributors]
122+
runs-on: ubuntu-latest
123+
if: ${{ needs.update-contributors.outputs.pull-request-operation == 'none' }}
124+
runs-on: ubuntu-latest
125+
steps:
126+
-
127+
name: Report no change needed
128+
run: |
129+
echo "::notice title=no-change::No change needed to the contributors file"
130+
exit 0
131+
119132
auto-merge:
120133
# description: |
121134
# Approves the PR, waits for all jobs (including non-required ones), and enables auto-merge.
@@ -129,6 +142,7 @@ jobs:
129142
contents: write
130143
pull-requests: write
131144
runs-on: ubuntu-latest
145+
if: ${{ needs.update-contributors.outputs.pull-request-operation != 'none' }}
132146
env:
133147
PR_URL: ${{ needs.update-contributors.outputs.pull-request-url }}
134148
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/prepare-release-monorepo.yml

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ on:
2323
pull-request-url:
2424
description: "URL of the created pull request"
2525
value: ${{ jobs.prepare-modules.outputs.pull-request-url }}
26+
pull-request-operation:
27+
description: "Pull request operation"
28+
value: ${{ jobs.prepare-modules.outputs.pull-request-operation }}
2629
inputs:
2730
target-tag:
2831
description: |
@@ -90,6 +93,7 @@ jobs:
9093
pull-requests: write
9194
outputs:
9295
pull-request-url: ${{ steps.create-pull-request.outputs.pull-request-url }}
96+
pull-request-operation: ${{ steps.create-pull-request.outputs.pull-request-operation }}
9397
steps:
9498
-
9599
name: Checkout repository
@@ -136,10 +140,12 @@ jobs:
136140
for dir in "${ALL_FOLDERS[@]}"; do
137141
echo "::notice title=processing-module::Processing module in ${dir}"
138142
pushd "${dir}" > /dev/null
143+
139144
echo "Original go.mod"
140145
cat go.mod
141146
142-
go mod download -x
147+
# Make sure we can get all dependencies
148+
go mod download
143149
144150
# List dependencies and update those matching the root module or sub-modules
145151
# This matches both the root module and any sub-modules under the same path.
@@ -155,6 +161,7 @@ jobs:
155161
sort -u | \
156162
grep "^${root_module}" | \
157163
grep -v "^${current_module}$" || true )
164+
158165
echo "Transformed go.mod"
159166
cat go.mod
160167
@@ -171,7 +178,7 @@ jobs:
171178
go work sync
172179
fi
173180
174-
# Show what changed
181+
# Show what has changed
175182
echo "::notice title=changes::Git status after updates"
176183
git status --short
177184
-
@@ -218,6 +225,18 @@ jobs:
218225
sign-commits: ${{ inputs.enable-commit-signing }}
219226
signoff: true # DCO
220227

228+
no-change:
229+
needs: [prepare-modules]
230+
runs-on: ubuntu-latest
231+
if: ${{ needs.update-contributors.outputs.pull-request-operation == 'none' }}
232+
runs-on: ubuntu-latest
233+
steps:
234+
-
235+
name: Report no change needed
236+
run: |
237+
echo "::notice title=no-change::No change needed to the go.mod files"
238+
exit 0
239+
221240
auto-merge:
222241
# description: |
223242
# Approves the PR, waits for all jobs (including non-required ones), and enables auto-merge.
@@ -234,6 +253,7 @@ jobs:
234253
contents: write
235254
pull-requests: write
236255
runs-on: ubuntu-latest
256+
if: ${{ needs.prepare-modules.outputs.pull-request-operation != 'none' }}
237257
env:
238258
PR_URL: ${{ needs.prepare-modules.outputs.pull-request-url }}
239259
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)