diff --git a/.github/workflows/build-ci-image.yml b/.github/workflows/build-ci-image.yml index 7d4d76e23c0..e883da19e03 100644 --- a/.github/workflows/build-ci-image.yml +++ b/.github/workflows/build-ci-image.yml @@ -7,7 +7,7 @@ on: paths: - 'gen.Dockerfile' - '.github/workflows/build-ci-image.yml' - pull_request: + pull_request_target: paths: - 'gen.Dockerfile' - '.github/workflows/build-ci-image.yml' @@ -38,6 +38,9 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha || github.sha }} + persist-credentials: false - name: Validate Depot project id run: | @@ -77,7 +80,7 @@ jobs: - name: Set image tag output id: set-tag run: | - if [ "${{ github.event_name }}" == "pull_request" ]; then + if [ "${{ github.event_name }}" == "pull_request" ] || [ "${{ github.event_name }}" == "pull_request_target" ]; then echo "tag=pr-${{ github.event.pull_request.number }}" >> $GITHUB_OUTPUT elif [ "${{ github.ref }}" == "refs/heads/v2" ]; then echo "tag=v2" >> $GITHUB_OUTPUT @@ -106,7 +109,7 @@ jobs: run: echo "Image built with digest ${{ steps.build.outputs.digest }}" - name: Comment on PR with image tag - if: github.event_name == 'pull_request' + if: github.event_name == 'pull_request' || github.event_name == 'pull_request_target' uses: actions/github-script@v7 with: script: | diff --git a/.github/workflows/check-generate.yml b/.github/workflows/check-generate.yml index af78f2297af..ede74fec5b6 100644 --- a/.github/workflows/check-generate.yml +++ b/.github/workflows/check-generate.yml @@ -48,7 +48,7 @@ jobs: owner: context.repo.owner, repo: context.repo.repo, workflow_id: 'build-ci-image.yml', - event: 'pull_request', + event: 'pull_request_target', per_page: 10 });