This is an automated email from the ASF dual-hosted git repository. gnodet pushed a commit to branch chore/ci-trigger-automated-prs in repository https://gitbox.apache.org/repos/asf/camel.git
commit a496bf278dd083569fef99a70cd106b083bee7a4 Author: Guillaume Nodet <[email protected]> AuthorDate: Mon Mar 9 17:51:01 2026 +0100 chore(ci): trigger CI builds for automated container version PRs PRs created by GITHUB_TOKEN don't trigger pull_request workflows. Add workflow_dispatch trigger to pr-build-main.yml and have check-container-versions.yml explicitly trigger it after PR creation. workflow_dispatch is an exception to the GITHUB_TOKEN limitation. Co-Authored-By: Claude Opus 4.6 <[email protected]> --- .github/actions/detect-dependencies/action.yaml | 6 +++++- .github/workflows/check-container-versions.yml | 12 ++++++++++++ .github/workflows/pr-build-main.yml | 16 ++++++++++++++-- 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/.github/actions/detect-dependencies/action.yaml b/.github/actions/detect-dependencies/action.yaml index 52a142f8075a..3db5cf5bcc70 100644 --- a/.github/actions/detect-dependencies/action.yaml +++ b/.github/actions/detect-dependencies/action.yaml @@ -21,6 +21,10 @@ inputs: github-token: description: 'The github token to access to the API' required: false + base-ref: + description: 'The base branch to compare against (defaults to github.base_ref)' + required: false + default: '' runs: using: "composite" steps: @@ -32,4 +36,4 @@ runs: env: GITHUB_TOKEN: ${{ inputs.github-token }} shell: bash - run: ${{ github.action_path }}/detect-test.sh ${{ github.base_ref }} ${{ steps.install-mvnd.outputs.mvnd-dir }}/mvnd + run: ${{ github.action_path }}/detect-test.sh ${{ inputs.base-ref || github.base_ref }} ${{ steps.install-mvnd.outputs.mvnd-dir }}/mvnd diff --git a/.github/workflows/check-container-versions.yml b/.github/workflows/check-container-versions.yml index 65e02dfa5f48..a2cebd46466d 100644 --- a/.github/workflows/check-container-versions.yml +++ b/.github/workflows/check-container-versions.yml @@ -39,6 +39,7 @@ jobs: permissions: contents: write pull-requests: write + actions: write steps: - name: Checkout repository @@ -304,6 +305,17 @@ jobs: echo "✅ PR created successfully for $PROPERTY_NAME" PRS_CREATED=$((PRS_CREATED + 1)) + + # Trigger CI build for the PR via workflow_dispatch + # (GITHUB_TOKEN events don't trigger pull_request workflows, + # but workflow_dispatch is an exception to this limitation) + PR_NUMBER=$(gh pr view "$BRANCH_NAME" --json number --jq '.number' 2>/dev/null || echo "") + if [[ -n "$PR_NUMBER" ]]; then + echo "Triggering CI build for PR #$PR_NUMBER on branch $BRANCH_NAME" + gh workflow run pr-build-main.yml \ + -f pr_number="$PR_NUMBER" \ + -f pr_ref="$BRANCH_NAME" || echo "⚠️ Failed to trigger CI build" + fi else echo "❌ Failed to create PR for $PROPERTY_NAME" fi diff --git a/.github/workflows/pr-build-main.yml b/.github/workflows/pr-build-main.yml index 4a882fdfd69c..9710aba414f4 100644 --- a/.github/workflows/pr-build-main.yml +++ b/.github/workflows/pr-build-main.yml @@ -28,9 +28,19 @@ on: - Jenkinsfile - Jenkinsfile.* - NOTICE.txt + workflow_dispatch: + inputs: + pr_number: + description: 'Pull request number to build' + required: true + type: string + pr_ref: + description: 'Git ref of the pull request branch' + required: true + type: string concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + group: ${{ github.workflow }}-${{ github.event.pull_request.number || inputs.pr_number || github.ref }} cancel-in-progress: true permissions: @@ -55,6 +65,7 @@ jobs: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: persist-credentials: false + ref: ${{ inputs.pr_ref || '' }} - id: install-packages uses: ./.github/actions/install-packages - id: install-mvnd @@ -81,7 +92,7 @@ jobs: uses: ./.github/actions/incremental-build with: mode: test - pr-id: ${{ github.event.number }} + pr-id: ${{ github.event.number || inputs.pr_number }} github-token: ${{ secrets.GITHUB_TOKEN }} skip-mvnd-install: 'true' artifact-upload-suffix: java-${{ matrix.java }} @@ -89,3 +100,4 @@ jobs: uses: ./.github/actions/detect-dependencies with: github-token: ${{ secrets.GITHUB_TOKEN }} + base-ref: ${{ github.base_ref || 'main' }}
