From 97e24a3a591ab17fccb71471c4a0072257cbadc5 Mon Sep 17 00:00:00 2001 From: Stuti Ravikiran Wali Date: Thu, 7 May 2026 16:29:08 +0530 Subject: [PATCH 1/4] Implement check_changes job in PR workflow Add a job to check for relevant file changes before build. --- .github/workflows/pr-build.yaml | 91 +++++++++++++++++++++++++++++++-- 1 file changed, 88 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr-build.yaml b/.github/workflows/pr-build.yaml index 00f32e096a..e9b76cb0ed 100644 --- a/.github/workflows/pr-build.yaml +++ b/.github/workflows/pr-build.yaml @@ -28,7 +28,53 @@ run-name: > jobs: + check_changes: + runs-on: ubuntu-latest + outputs: + should_build: ${{ steps.filter.outputs.should_build }} + changed_files: ${{ steps.filter.outputs.changed_files }} + steps: + - name: Checkout code + uses: actions/checkout@v6 + with: + fetch-depth: 0 + + - name: Check for relevant file changes + id: filter + run: | + if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then + echo "should_build=true" >> $GITHUB_OUTPUT + echo "Workflow dispatch - proceeding with build" + exit 0 + fi + + git fetch origin ${{ github.base_ref }} --depth=1 + CHANGED_FILES=$(git diff --name-only origin/${{ github.base_ref }}...HEAD) + + echo "Changed files:" + echo "$CHANGED_FILES" + + # Store changed files for reuse in later jobs + echo "changed_files<> $GITHUB_OUTPUT + echo "$CHANGED_FILES" >> $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT + + # Check for build_info.json, .sh scripts, or Dockerfile + RELEVANT_CHANGES=$(echo "$CHANGED_FILES" | grep -E '(build_info\.json|\.sh$|Dockerfile)' || true) + + if [ -n "$RELEVANT_CHANGES" ]; then + echo "should_build=true" >> $GITHUB_OUTPUT + echo "✅ Found relevant changes:" + echo "$RELEVANT_CHANGES" + else + echo "should_build=false" >> $GITHUB_OUTPUT + echo "⏭️ Skipping PR build CI check - no changes related to build_info.json, build scripts (.sh), or Dockerfile" + fi + + build_info: + needs: check_changes + if: needs.check_changes.outputs.should_build == 'true' runs-on: ${{ github.event_name == 'pull_request' && 'ubuntu-24.04-ppc64le-p10' || inputs.large-runner }} steps: @@ -77,10 +123,50 @@ jobs: - name: Fetch base branch run: git fetch origin ${{ github.base_ref }} --depth=1 + # - name: Locate and parse build_info.json + # run: | + + # CHANGED_FILES=$(git diff --name-only origin/${{ github.base_ref }}...HEAD) + + # BUILD_INFO_FILE=$(echo "$CHANGED_FILES" | grep 'build_info.json' | head -n 1) + + # if [ -z "$BUILD_INFO_FILE" ]; then + # echo "No build_info.json modified, trying to detect from changed files..." + + # PACKAGE_DIR=$(echo "$CHANGED_FILES" | head -n 1 | cut -d'/' -f1-2) + + # BUILD_INFO_FILE="$PACKAGE_DIR/build_info.json" + + # if [ ! -f "$BUILD_INFO_FILE" ]; then + # echo "Could not locate build_info.json!" + # exit 1 + # fi + + # echo "Using fallback build_info: $BUILD_INFO_FILE" + # fi + + # PACKAGE_NAME=$(jq -r '.package_name // ""' $BUILD_INFO_FILE) + # VERSION=$(jq -r '.version // ""' $BUILD_INFO_FILE) + + # echo "BUILD_INFO_FILE=$BUILD_INFO_FILE" >> $GITHUB_ENV + # echo "PACKAGE_NAME=$PACKAGE_NAME" >> $GITHUB_ENV + # echo "VERSION=$VERSION" >> $GITHUB_ENV + # echo "CHANGED_FILES<> $GITHUB_ENV + # echo "$CHANGED_FILES" >> $GITHUB_ENV + # echo "EOF" >> $GITHUB_ENV + + + - name: Locate and parse build_info.json run: | - - CHANGED_FILES=$(git diff --name-only origin/${{ github.base_ref }}...HEAD) + # Reuse changed files from check_changes job + CHANGED_FILES="${{ needs.check_changes.outputs.changed_files }}" + + # If workflow_dispatch, fetch and compute changed files + if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then + git fetch origin ${{ github.base_ref }} --depth=1 + CHANGED_FILES=$(git diff --name-only origin/${{ github.base_ref }}...HEAD) + fi BUILD_INFO_FILE=$(echo "$CHANGED_FILES" | grep 'build_info.json' | head -n 1) @@ -109,7 +195,6 @@ jobs: echo "$CHANGED_FILES" >> $GITHUB_ENV echo "EOF" >> $GITHUB_ENV - - name: Read build_info.json run: | chmod +x ./gha-script/read_buildinfo.sh From 71090b2a28d950a2162463ff223cd54853e79d11 Mon Sep 17 00:00:00 2001 From: Stuti Ravikiran Wali Date: Thu, 7 May 2026 16:30:10 +0530 Subject: [PATCH 2/4] Change GitHub build script owner to 'stutiibm' --- gha-script/validate_builds.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gha-script/validate_builds.py b/gha-script/validate_builds.py index 54094dcce1..9b568fab84 100644 --- a/gha-script/validate_builds.py +++ b/gha-script/validate_builds.py @@ -11,7 +11,7 @@ GITHUB_BUILD_SCRIPT_BASE_REPO = "build-scripts" -GITHUB_BUILD_SCRIPT_BASE_OWNER = "ppc64le" +GITHUB_BUILD_SCRIPT_BASE_OWNER = "stutiibm" HOME = os.getcwd() package_data = {} From 3bd35404c5e8b66957832739502cf29aa5ff5e99 Mon Sep 17 00:00:00 2001 From: Stuti Ravikiran Wali Date: Thu, 7 May 2026 16:31:56 +0530 Subject: [PATCH 3/4] Update checkout steps to use pull request repo and ref --- .github/workflows/pr-build.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/pr-build.yaml b/.github/workflows/pr-build.yaml index e9b76cb0ed..8e365dc7d8 100644 --- a/.github/workflows/pr-build.yaml +++ b/.github/workflows/pr-build.yaml @@ -37,6 +37,8 @@ jobs: - name: Checkout code uses: actions/checkout@v6 with: + repository: ${{ github.event.pull_request.head.repo.full_name }} + ref: ${{ github.event.pull_request.head.ref }} fetch-depth: 0 - name: Check for relevant file changes @@ -82,6 +84,8 @@ jobs: if: github.event_name == 'pull_request' uses: actions/checkout@v6 with: + repository: ${{ github.event.pull_request.head.repo.full_name }} + ref: ${{ github.event.pull_request.head.ref }} fetch-depth: 0 - name: Checkout code (Workflow Dispatch) From 72ff497028d92dc65601663a6715e375ad9add11 Mon Sep 17 00:00:00 2001 From: Stuti Ravikiran Wali Date: Thu, 7 May 2026 16:37:21 +0530 Subject: [PATCH 4/4] Update Dockerfile --- p/param/Dockerfiles/v2.1.0_ubi_9/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/p/param/Dockerfiles/v2.1.0_ubi_9/Dockerfile b/p/param/Dockerfiles/v2.1.0_ubi_9/Dockerfile index 7d758cdc83..d14f20890b 100644 --- a/p/param/Dockerfiles/v2.1.0_ubi_9/Dockerfile +++ b/p/param/Dockerfiles/v2.1.0_ubi_9/Dockerfile @@ -15,5 +15,6 @@ RUN yum update -y && \ cd param && \ git checkout $PACKAGE_VERSION && \ python3 -m pip install build + CMD ["/bin/bash"]