fix: workflows#338
Conversation
|
commit: |
There was a problem hiding this comment.
Pull request overview
Updates GitHub Actions workflows to adjust which PR events they run on and which refs they check out, aiming to fix CI/preview behavior for pull requests.
Changes:
- Switch
Testworkflow trigger frompull_request_targettopull_request. - Configure
Package Previewworkflow to check outrefs/pull/<number>/mergeinstead of the base branch when usingpull_request_target.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
.github/workflows/test.yml |
Changes PR trigger type for the main CI workflow. |
.github/workflows/package-preview.yml |
Checks out the PR merge ref for preview package publishing. |
| pull_request: | ||
| push: | ||
| branches: | ||
| - "*" # matches every branch that doesn't contain a '/' |
There was a problem hiding this comment.
runs-on is computed from the inputs context in this workflow, but inputs is only populated for workflow_call / workflow_dispatch. Now that this workflow runs on pull_request (and push), referencing inputs.os can cause expression evaluation to fail on those events. Consider removing the inputs.* usage for PR/push runs (e.g., hardcode runners or use github.event.inputs only for workflow_dispatch / split the reusable workflow from the PR/push workflow).
| - uses: actions/checkout@v4 | ||
| # with: | ||
| # ref: refs/pull/${{ github.event.number }}/merge | ||
| with: | ||
| ref: refs/pull/${{ github.event.number }}/merge | ||
|
|
There was a problem hiding this comment.
This workflow is triggered by pull_request_target but explicitly checks out the PR merge ref and then runs bun install / repo code (codegen, pkg-pr-new). With pull_request_target, the job runs in the base-repo security context (and typically has broader GITHUB_TOKEN permissions), so a malicious PR can execute arbitrary code and exfiltrate credentials. Mitigate by switching to pull_request, or restricting to same-repo PRs (if: github.event.pull_request.head.repo.full_name == github.repository), and explicitly minimizing permissions + disabling install scripts (bun install --ignore-scripts --frozen-lockfile) if you must keep pull_request_target.
No description provided.