Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions .github/workflows/build-ci-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Comment on lines 9 to 13
Copy link

Copilot AI May 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Switching this workflow to pull_request_target changes github.ref to the PR base branch (e.g. refs/heads/main). With the current docker/metadata-action config and unconditional push: true, fork PRs can end up pushing branch tags (e.g. main) and also latest/v2 (because the enable expressions use github.ref). This contradicts the PR description’s “pr- only” guarantee and is a security/operational risk (tag overwrite). Consider gating pushing to base-repo PRs only (e.g. head.repo.full_name == github.repository) and/or making tags PR-scoped when event_name == 'pull_request_target' (disable latest/v2/branch tags on PR runs).

Copilot uses AI. Check for mistakes.
Expand Down Expand Up @@ -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: |
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/check-generate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
});

Expand Down
Loading