Skip to content

Commit 3f9870d

Browse files
fix: close potentially already existing PRs (#3160)
* fix: close potentially already existing PRs * Apply suggestions from code review Co-authored-by: Piotr Zaniewski <[email protected]> --------- Co-authored-by: Piotr Zaniewski <[email protected]>
1 parent f1b489f commit 3f9870d

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

.github/workflows/sync-config-schema.yaml

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ jobs:
3131
final_tag="${{ github.event.release.tag_name }}"
3232
fi
3333
echo "release_tag=${final_tag}" >> "$GITHUB_OUTPUT"
34-
34+
3535
# Remove 'v' prefix if present for semver validation
3636
version_without_v="${final_tag#v}"
3737
echo "version_without_v=${version_without_v}" >> "$GITHUB_OUTPUT"
38-
38+
3939
if [[ "${final_tag}" == *"-alpha."* || "${final_tag}" == *"-next."* ]]; then
4040
echo "is_alpha_version=true" >> "$GITHUB_OUTPUT"
4141
echo "is_stable_version=false" >> "$GITHUB_OUTPUT"
@@ -47,7 +47,7 @@ jobs:
4747
else
4848
echo "is_stable_version=true" >> "$GITHUB_OUTPUT"
4949
fi
50-
50+
5151
- name: Parse version with semver
5252
if: ${{ steps.release.outputs.is_alpha_version == 'false' }}
5353
id: semver
@@ -95,11 +95,11 @@ jobs:
9595
# Use parsed version from semver action
9696
MAJOR_VERSION=$(echo "${PARSED_VERSION}" | jq -r '.major')
9797
MINOR_VERSION=$(echo "${PARSED_VERSION}" | jq -r '.minor')
98-
98+
9999
# For RC releases, we use major.minor.0 format for the docs folder
100100
MINOR_VERSION_WITH_PATCH="${MAJOR_VERSION}.${MINOR_VERSION}.0"
101101
echo "Extracted minor version: ${MINOR_VERSION_WITH_PATCH} from tag: ${RELEASE_TAG}"
102-
102+
103103
# Determine target folder - use version folder for RC releases, main for beta
104104
if [[ "${RELEASE_TAG}" == *"-rc"* ]]; then
105105
TARGET_VERSION="${MINOR_VERSION_WITH_PATCH}"
@@ -137,7 +137,7 @@ jobs:
137137
# generate vcluster partials for target version
138138
go mod tidy
139139
go mod vendor
140-
140+
141141
# Determine output path based on target version
142142
if [[ "${TARGET_VERSION}" == "main" ]]; then
143143
OUTPUT_PATH="vcluster/_partials/config"
@@ -146,7 +146,7 @@ jobs:
146146
# Ensure versioned directory exists
147147
mkdir -p "vcluster_versioned_docs/version-${TARGET_VERSION}"
148148
fi
149-
149+
150150
go run hack/vcluster/partials/main.go "configsrc/vcluster/${TARGET_VERSION}" "${OUTPUT_PATH}"
151151
152152
# set git info
@@ -164,6 +164,8 @@ jobs:
164164
# create a PR in vcluster-docs with generated partials
165165
git commit -m "chore: generate vCluster partials for ${TARGET_VERSION} version based on values.schema.json in vCluster ${RELEASE_TAG}"
166166
git push -u origin -f "${branch_name}"
167+
168+
gh pr close "${branch_name}" --comment "Closing to recreate with updated changes from ${RELEASE_TAG}" || true
167169
gh pr create --fill --head "${branch_name}"
168170
echo "Create PR in vcluster-docs"
169171
@@ -203,15 +205,15 @@ jobs:
203205
# Use parsed version from semver action
204206
MAJOR_VERSION=$(echo "${PARSED_VERSION}" | jq -r '.major')
205207
MINOR_VERSION=$(echo "${PARSED_VERSION}" | jq -r '.minor')
206-
208+
207209
# Use the vcluster-vX.Y format for tags
208210
TARGET_TAG="vcluster-v${MAJOR_VERSION}.${MINOR_VERSION}"
209-
211+
210212
# commit changes
211213
git commit -m "chore: sync config/*.go and values.schema.json to vCluster version ${RELEASE_TAG}"
212-
214+
213215
# Update the existing tag to point to the new commit
214216
git tag -f "${TARGET_TAG}"
215217
git push -u origin -f "${TARGET_TAG}"
216-
218+
217219
echo "vcluster-config tag ${TARGET_TAG} updated to vCluster version ${RELEASE_TAG}"

0 commit comments

Comments
 (0)