From c2ba47bdd867e8ecdacf4e36aa88e5fb08893601 Mon Sep 17 00:00:00 2001 From: ByteBaker <42913098+ByteBaker@users.noreply.github.com> Date: Fri, 13 Feb 2026 16:28:12 +0530 Subject: [PATCH] chore: make OSS Docker image build manual-only (#10190) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary - Switch `build-pr-image.yml` from auto-triggering on every PR to `workflow_dispatch` only ## Why OSS Docker image builds on every PR waste CI compute. The image isn't always needed — developers can trigger it manually when required. --------- Co-authored-by: Yashodhan Joshi --- .github/workflows/build-pr-image.yml | 65 ++++++---------------------- 1 file changed, 14 insertions(+), 51 deletions(-) diff --git a/.github/workflows/build-pr-image.yml b/.github/workflows/build-pr-image.yml index bde8c6408e..7faf15391d 100644 --- a/.github/workflows/build-pr-image.yml +++ b/.github/workflows/build-pr-image.yml @@ -1,56 +1,26 @@ name: Build PR Docker Image on: - pull_request: - branches: - - "*" + workflow_dispatch: + inputs: + branch: + description: 'Branch to build (e.g., feature/my-branch)' + required: true + type: string concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + group: ${{ github.workflow }}-${{ inputs.branch }} cancel-in-progress: true env: AWS_REGION: us-east-1 jobs: - check_changes: - runs-on: ubuntu-latest - permissions: - contents: read - outputs: - has_changes: ${{ steps.check_changes.outputs.has_changes }} - should_build: ${{ steps.check_changes.outputs.should_build }} - steps: - - name: Clone the current repo - uses: actions/checkout@v5 - with: - fetch-depth: 0 - - - name: Check if relevant code has changes - id: check_changes - run: | - if git diff --name-only origin/${{ github.base_ref || 'main' }} ${{ github.sha }} | grep -qvE '\.(md|yml|yaml)$'; then - echo "has_changes=true" >> $GITHUB_OUTPUT - else - echo "has_changes=false" >> $GITHUB_OUTPUT - fi - - # Also check if this is a non-fork PR - if [ "${{ github.event_name }}" == "pull_request" ] && \ - [ "${{ github.event.pull_request.head.repo.full_name }}" == "${{ github.repository }}" ] && \ - [ "${{ github.event.pull_request.head.repo.fork }}" == "false" ]; then - echo "should_build=true" >> $GITHUB_OUTPUT - else - echo "should_build=false" >> $GITHUB_OUTPUT - fi - build_pr_image_amd64: name: build_pr_image_amd64 - needs: check_changes permissions: id-token: write contents: read - if: needs.check_changes.outputs.has_changes == 'true' && needs.check_changes.outputs.should_build == 'true' runs-on: ubicloud-standard-8 steps: - name: Remove unused tools @@ -63,8 +33,8 @@ jobs: - name: Clone the current repo uses: actions/checkout@v5 with: - repository: ${{ github.event.pull_request.head.repo.full_name }} - ref: ${{ github.event.pull_request.head.ref || github.ref }} + repository: ${{ github.repository }} + ref: ${{ inputs.branch }} fetch-depth: 0 fetch-tags: true @@ -133,11 +103,9 @@ jobs: build_pr_image_arm64: name: build_pr_image_arm64 - needs: check_changes permissions: id-token: write contents: read - if: needs.check_changes.outputs.has_changes == 'true' && needs.check_changes.outputs.should_build == 'true' runs-on: "ubicloud-standard-16-arm" steps: - name: Remove unused tools @@ -150,8 +118,8 @@ jobs: - name: Clone the current repo uses: actions/checkout@v5 with: - repository: ${{ github.event.pull_request.head.repo.full_name }} - ref: ${{ github.event.pull_request.head.ref || github.ref }} + repository: ${{ github.repository }} + ref: ${{ inputs.branch }} fetch-depth: 0 fetch-tags: true @@ -229,8 +197,8 @@ jobs: - name: Clone the current repo uses: actions/checkout@v5 with: - repository: ${{ github.event.pull_request.head.repo.full_name }} - ref: ${{ github.event.pull_request.head.ref || github.ref }} + repository: ${{ github.repository }} + ref: ${{ inputs.branch }} fetch-depth: 0 fetch-tags: true - name: Set GIT_TAG env @@ -261,16 +229,11 @@ jobs: build_pr_image_summary: runs-on: ubuntu-latest permissions: {} - needs: [check_changes, build_pr_image_amd64, build_pr_image_arm64, build] + needs: [build_pr_image_amd64, build_pr_image_arm64, build] if: always() steps: - name: Check build results run: | - if [ "${{ needs.check_changes.outputs.has_changes }}" != "true" ] || [ "${{ needs.check_changes.outputs.should_build }}" != "true" ]; then - echo "No relevant changes or not a non-fork PR - builds skipped" - exit 0 - fi - if [ "${{ needs.build_pr_image_amd64.result }}" == "success" ] || [ "${{ needs.build_pr_image_amd64.result }}" == "skipped" ]; then echo "AMD64 build passed or skipped" else