Skip to content

Commit 47bce59

Browse files
paulopmt1DemocursoragentCopilotclaude
authored
CI: Skip plugin repo release when SVN tag already exists (#78476)
* CI: Skip plugin repo release when SVN tag already exists Avoid E150002 on workflow re-runs by checking tags/$VERSION on WordPress.org before svn cp or svn import in both upload jobs. Co-authored-by: Cursor <cursoragent@cursor.com> * Remove check from the upload stage * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * CI: Apply tag-exists guard to upload-tag job Mirror the SVN tag existence check added to the upload job so the upload-tag job's `svn import` is also skipped (with a workflow warning) when the tag is already present, avoiding E150002. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Demo <demo@local> Co-authored-by: Cursor <cursoragent@cursor.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent c980422 commit 47bce59

1 file changed

Lines changed: 44 additions & 0 deletions

File tree

‎.github/workflows/upload-release-to-plugin-repo.yml‎

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,29 @@ jobs:
227227
name: changelog trunk
228228
path: trunk
229229

230+
- name: Check if SVN tag already exists
231+
id: check_svn_tag
232+
run: |
233+
svn_error_file="$(mktemp)"
234+
if svn list "$PLUGIN_REPO_URL/tags/$VERSION" \
235+
--username "$SVN_USERNAME" --password "$SVN_PASSWORD" \
236+
--non-interactive --no-auth-cache >/dev/null 2>"$svn_error_file"; then
237+
echo "::warning::SVN tag tags/$VERSION already exists. Skipping release commit to avoid E150002."
238+
echo "exists=true" >> "$GITHUB_OUTPUT"
239+
else
240+
svn_status=$?
241+
if grep -q 'E160013' "$svn_error_file"; then
242+
echo "exists=false" >> "$GITHUB_OUTPUT"
243+
else
244+
cat "$svn_error_file" >&2
245+
rm -f "$svn_error_file"
246+
exit "$svn_status"
247+
fi
248+
fi
249+
rm -f "$svn_error_file"
250+
230251
- name: Commit the release
252+
if: steps.check_svn_tag.outputs.exists != 'true'
231253
working-directory: ./trunk
232254
run: |
233255
svn st | grep '^?' | awk '{print $2}' | xargs -r svn add
@@ -279,7 +301,29 @@ jobs:
279301
name: changelog trunk
280302
path: ${{ github.event.release.name }}
281303

304+
- name: Check if SVN tag already exists
305+
id: check_svn_tag
306+
run: |
307+
svn_error_file="$(mktemp)"
308+
if svn list "$PLUGIN_REPO_URL/tags/$VERSION" \
309+
--username "$SVN_USERNAME" --password "$SVN_PASSWORD" \
310+
--non-interactive --no-auth-cache >/dev/null 2>"$svn_error_file"; then
311+
echo "::warning::SVN tag tags/$VERSION already exists. Skipping import to avoid E150002."
312+
echo "exists=true" >> "$GITHUB_OUTPUT"
313+
else
314+
svn_status=$?
315+
if grep -q 'E160013' "$svn_error_file"; then
316+
echo "exists=false" >> "$GITHUB_OUTPUT"
317+
else
318+
cat "$svn_error_file" >&2
319+
rm -f "$svn_error_file"
320+
exit "$svn_status"
321+
fi
322+
fi
323+
rm -f "$svn_error_file"
324+
282325
- name: Add the new version directory and commit changes to the SVN repository
326+
if: steps.check_svn_tag.outputs.exists != 'true'
283327
run: |
284328
svn import "$VERSION" "$PLUGIN_REPO_URL/tags/$VERSION" -m "Committing version $VERSION" \
285329
--no-auth-cache --non-interactive --username "$SVN_USERNAME" --password "$SVN_PASSWORD" \

0 commit comments

Comments
 (0)