From da3b5d0c190563751d3c70ad40654b6c72337960 Mon Sep 17 00:00:00 2001 From: Duane May Date: Thu, 2 Jul 2026 23:23:08 -0400 Subject: [PATCH 1/2] Enable PR creation in upgrade workflows for Java and Tomcat. --- .github/workflows/upgrade-java.yml | 11 ++++++++--- .github/workflows/upgrade-tomcat.yml | 12 +++++++++--- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/.github/workflows/upgrade-java.yml b/.github/workflows/upgrade-java.yml index ab1adf044..425289f67 100644 --- a/.github/workflows/upgrade-java.yml +++ b/.github/workflows/upgrade-java.yml @@ -10,6 +10,7 @@ jobs: runs-on: ubuntu-24.04 permissions: contents: write + pull-requests: write strategy: matrix: java: [ '25' ] @@ -86,8 +87,12 @@ jobs: git status git add config/blobs.yml git status - + + BRANCH_NAME="Java-${JDK_VERSION}" + git checkout -b "${BRANCH_NAME}" git commit -m "Upgrade Bellsoft JDK to version ${JDK_VERSION}" - git push - + git push -u origin "${BRANCH_NAME}" + echo "✅ Committed $(git log -n 1 --graph --pretty='%Cred%h%Creset - %s%Creset' | sed 's/^.//')" >> $GITHUB_STEP_SUMMARY + + gh pr create --title "Upgrade Bellsoft JDK to version ${JDK_VERSION}" --body "Automated upgrade of Bellsoft JDK to version ${JDK_VERSION}." diff --git a/.github/workflows/upgrade-tomcat.yml b/.github/workflows/upgrade-tomcat.yml index 761778df2..afbfca749 100644 --- a/.github/workflows/upgrade-tomcat.yml +++ b/.github/workflows/upgrade-tomcat.yml @@ -13,6 +13,7 @@ jobs: runs-on: ubuntu-24.04 permissions: contents: write + pull-requests: write strategy: matrix: tomcat: [ '11' ] @@ -45,6 +46,7 @@ jobs: - name: Check Tomcat Version env: TOMCAT_VERSION: ${{ matrix.tomcat }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | TOMCAT_INDEX_URL=${TOMCAT_BASE_URL}/tomcat-${TOMCAT_VERSION} tomcat_versions="$(curl -sSfL "${TOMCAT_INDEX_URL}" \ @@ -88,9 +90,13 @@ jobs: git status git add config/blobs.yml git status - + + BRANCH_NAME="Tomcat-${LATEST_TOMCAT_VERSION}" + git checkout -b "${BRANCH_NAME}" git commit -m "Upgrade Tomcat to version $LATEST_TOMCAT_VERSION" - git push - + git push -u origin "${BRANCH_NAME}" + commit_id=$(git log -n 1 --graph --pretty='%Cred%h%Creset - %s%Creset' | sed 's/^.//') echo "✅ Committed ${commit_id}" >> $GITHUB_STEP_SUMMARY + + gh pr create --title "Upgrade Tomcat to version ${LATEST_TOMCAT_VERSION}" --body "Automated upgrade of Tomcat to version ${LATEST_TOMCAT_VERSION}." From 96292d6ff45e1fb7888a59fb68211513c8461c08 Mon Sep 17 00:00:00 2001 From: Duane May Date: Fri, 3 Jul 2026 08:57:21 -0400 Subject: [PATCH 2/2] Address Copilot review feedback on upgrade workflows Use GH_TOKEN (consistent with the existing gh usage in the BOSH CLI setup step) instead of GITHUB_TOKEN, and skip branch/PR creation when an open PR already exists for the version branch so scheduled re-runs don't fail on a non-fast-forward push or duplicate PR. Co-Authored-By: Claude Sonnet 5 --- .github/workflows/upgrade-java.yml | 8 +++++++- .github/workflows/upgrade-tomcat.yml | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/.github/workflows/upgrade-java.yml b/.github/workflows/upgrade-java.yml index 425289f67..5396c0ba4 100644 --- a/.github/workflows/upgrade-java.yml +++ b/.github/workflows/upgrade-java.yml @@ -43,7 +43,7 @@ jobs: - name: Check Java Version env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | java_major_version=${{ matrix.java }} binary_metadata_url="https://api.bell-sw.com/v1/liberica/releases?version-modifier=latest" @@ -89,6 +89,12 @@ jobs: git status BRANCH_NAME="Java-${JDK_VERSION}" + + if [[ -n "$(gh pr list --head "${BRANCH_NAME}" --state open --json number --jq '.[0].number')" ]]; then + echo "## ☑️ PR already open for ${BRANCH_NAME}" >> $GITHUB_STEP_SUMMARY + exit 0 + fi + git checkout -b "${BRANCH_NAME}" git commit -m "Upgrade Bellsoft JDK to version ${JDK_VERSION}" git push -u origin "${BRANCH_NAME}" diff --git a/.github/workflows/upgrade-tomcat.yml b/.github/workflows/upgrade-tomcat.yml index afbfca749..22e3b2e3a 100644 --- a/.github/workflows/upgrade-tomcat.yml +++ b/.github/workflows/upgrade-tomcat.yml @@ -46,7 +46,7 @@ jobs: - name: Check Tomcat Version env: TOMCAT_VERSION: ${{ matrix.tomcat }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | TOMCAT_INDEX_URL=${TOMCAT_BASE_URL}/tomcat-${TOMCAT_VERSION} tomcat_versions="$(curl -sSfL "${TOMCAT_INDEX_URL}" \ @@ -92,6 +92,12 @@ jobs: git status BRANCH_NAME="Tomcat-${LATEST_TOMCAT_VERSION}" + + if [[ -n "$(gh pr list --head "${BRANCH_NAME}" --state open --json number --jq '.[0].number')" ]]; then + echo "## ☑️ PR already open for ${BRANCH_NAME}" >> $GITHUB_STEP_SUMMARY + exit 0 + fi + git checkout -b "${BRANCH_NAME}" git commit -m "Upgrade Tomcat to version $LATEST_TOMCAT_VERSION" git push -u origin "${BRANCH_NAME}"