Skip to content

ci: Replace pull_request_target with pull_request in GitHub Actions - #310

Merged
sirambd merged 3 commits into
mainfrom
fix/replace-pull-request-target
Jul 1, 2026
Merged

ci: Replace pull_request_target with pull_request in GitHub Actions#310
sirambd merged 3 commits into
mainfrom
fix/replace-pull-request-target

Conversation

@baillyjamy

Copy link
Copy Markdown
Contributor

Description

Replace pull_request_target with pull_request in GitHub Actions workflows.

Why

pull_request_target runs 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_request is sufficient.

Changes

  • .github/workflows/dependent-issues.yml: pull_request_targetpull_request
  • .github/workflows/auto-author-assign.yml: pull_request_targetpull_request
  • .github/workflows/semantic-commit.yml (if present): pull_request_targetpull_request

@baillyjamy baillyjamy self-assigned this Jun 8, 2026
@baillyjamy
baillyjamy marked this pull request as ready for review July 1, 2026 06:00
Copilot AI review requested due to automatic review settings July 1, 2026 06:00
@sonarqubecloud

sonarqubecloud Bot commented Jul 1, 2026

Copy link
Copy Markdown

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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_request instead of pull_request_target.
  • Added job-level if: conditions to only execute on same-repo PRs (and still run for issues events 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
sirambd merged commit 1d34a13 into main Jul 1, 2026
10 checks passed
@sirambd
sirambd deleted the fix/replace-pull-request-target branch July 1, 2026 08:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants