From ce3566ec1d3e7d67e6372049d7e8195039376695 Mon Sep 17 00:00:00 2001 From: Mahesh GADAGI Date: Sat, 20 Dec 2025 10:39:33 +0530 Subject: [PATCH] fix: add pull_request_target trigger for bot PRs with duplicate run prevention - Add pull_request_target trigger to ci.yml and pr.yml workflows - Add conditional logic to skip duplicate runs: use pull_request_target only for bot PRs (github-actions[bot], renovate[bot]) - Explicitly checkout PR head SHA in pull_request_target events to ensure correct code version is tested --- .github/workflows/ci.yml | 11 ++++++++++- .github/workflows/pr.yml | 7 +++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 26c20a7..c00c584 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,6 +2,8 @@ name: ci on: pull_request: branches: [main, develop] + pull_request_target: + branches: [main, develop] push: branches: [main, develop] concurrency: @@ -16,10 +18,17 @@ jobs: build-and-test: name: Build and Test runs-on: ubuntu-latest - + # Skip duplicate runs: run pull_request_target only for bot PRs, pull_request for others + if: | + github.event_name != 'pull_request_target' || + github.actor == 'github-actions[bot]' || + github.actor == 'renovate[bot]' + steps: - name: Checkout uses: actions/checkout@v5 + with: + ref: ${{ github.event.pull_request.head.sha || github.sha }} - name: Setup pnpm uses: pnpm/action-setup@v4 diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index aba0860..c395a4c 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -2,11 +2,18 @@ name: pr on: pull_request: branches: [main, develop] + pull_request_target: + branches: [main, develop] concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number }} cancel-in-progress: true jobs: build: + # Skip duplicate runs: run pull_request_target only for bot PRs, pull_request for others + if: | + github.event_name != 'pull_request_target' || + github.actor == 'github-actions[bot]' || + github.actor == 'renovate[bot]' uses: './.github/workflows/build.yml' with: dockerPublish: false