Skip to content

Commit e529655

Browse files
committed
tools: skip existing OpenSSL updates on schedule
Preserve the update branch when it already contains the selected OpenSSL version, keeping approvals and CI valid for the commit queue. Manual dispatches can still regenerate the update. Signed-off-by: Filip Skokan <panva.ip@gmail.com> Assisted-by: Codex
1 parent 45ae12c commit e529655

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

‎.github/workflows/update-openssl.yml‎

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ jobs:
2626
env:
2727
TARGET_BRANCH: ${{ github.ref_name }}
2828
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
29+
PR_BRANCH: actions/${{ github.ref_name != github.event.repository.default_branch && format('{0}/', github.ref_name) || '' }}tools-update-openssl
2930
steps:
3031
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
3132
with:
@@ -47,6 +48,21 @@ jobs:
4748
env:
4849
GITHUB_TOKEN: ${{ secrets.GH_USER_TOKEN }}
4950
INCLUDE_PRERELEASES: ${{ github.event_name == 'workflow_dispatch' && inputs.include_prereleases }}
51+
- name: Skip existing OpenSSL update
52+
if: env.NEW_VERSION && github.event_name != 'workflow_dispatch'
53+
shell: bash
54+
run: |
55+
branch=$(git ls-remote --heads origin "refs/heads/$PR_BRANCH")
56+
if [ -z "$branch" ]; then
57+
exit 0
58+
fi
59+
git fetch --depth=1 --no-tags origin "refs/heads/$PR_BRANCH"
60+
version=$(git show FETCH_HEAD:deps/openssl/config/archs/linux-x86_64/asm/include/openssl/opensslv.h \
61+
| awk -F '"' '/OPENSSL_FULL_VERSION_STR/ { gsub(/-/, "+", $2); print $2 }')
62+
if [ "$version" = "$NEW_VERSION" ]; then
63+
echo "The update branch already contains OpenSSL $NEW_VERSION; skipping the scheduled update."
64+
echo 'NEW_VERSION=' >> "$GITHUB_ENV"
65+
fi
5066
- name: Commit OpenSSL sources
5167
if: env.NEW_VERSION
5268
run: |
@@ -72,6 +88,6 @@ jobs:
7288
author: Node.js GitHub Bot <github-bot@iojs.org>
7389
committer: Node.js GitHub Bot <github-bot@iojs.org>
7490
body: This is an automated update of OpenSSL to ${{ env.NEW_VERSION }} for ${{ github.ref_name }}.
75-
branch: actions/${{ github.ref_name != github.event.repository.default_branch && format('{0}/', github.ref_name) || '' }}tools-update-openssl
91+
branch: ${{ env.PR_BRANCH }}
7692
labels: dependencies, openssl
7793
title: '${{ env.PR_TITLE_PREFIX }}deps: update OpenSSL to ${{ env.NEW_VERSION }}'

0 commit comments

Comments
 (0)