ci: Replace pull_request_target with pull_request in GitHub Actions - #310
Merged
Conversation
baillyjamy
marked this pull request as ready for review
July 1, 2026 06:00
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR hardens GitHub Actions execution for PR-related workflows by switching from pull_request_target (base-branch context with broader secret exposure) to pull_request, and adds job-level guards to avoid running write-capable jobs on forked PRs.
Changes:
- Updated workflows to trigger on
pull_requestinstead ofpull_request_target. - Added job-level
if:conditions to only execute on same-repo PRs (and still run forissuesevents where applicable).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
.github/workflows/dependent-issues.yml |
Switches to pull_request and adds a job if: guard to skip fork PRs while still running on issues events. |
.github/workflows/auto-author-assign.yml |
Switches to pull_request and adds a job if: guard to skip fork PRs (where write permissions wouldn’t be available). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
sirambd
approved these changes
Jul 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Description
Replace
pull_request_targetwithpull_requestin GitHub Actions workflows.Why
pull_request_targetruns in the context of the base branch with full access to repository secrets, even for fork PRs. This is unnecessary and a potential security risk for workflows that only need read access (semantic commit check, dependent issues, auto-author assign).Since all PRs come from within the organization,
pull_requestis sufficient.Changes
.github/workflows/dependent-issues.yml:pull_request_target→pull_request.github/workflows/auto-author-assign.yml:pull_request_target→pull_request.github/workflows/semantic-commit.yml(if present):pull_request_target→pull_request