diff --git a/.github/workflows/upgrade-java.yml b/.github/workflows/upgrade-java.yml index ab1adf044..5396c0ba4 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' ] @@ -42,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" @@ -86,8 +87,18 @@ jobs: git status git add config/blobs.yml 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 - + 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..22e3b2e3a 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 }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | TOMCAT_INDEX_URL=${TOMCAT_BASE_URL}/tomcat-${TOMCAT_VERSION} tomcat_versions="$(curl -sSfL "${TOMCAT_INDEX_URL}" \ @@ -88,9 +90,19 @@ jobs: git status git add config/blobs.yml 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 - + 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}."