Skip to content

ci: trigger the PR labeler on pull_request - #293

Merged
MarTrepodi merged 1 commit into
developfrom
ci/labeler-pull-request-trigger
Dec 5, 2026
Merged

MarTrepodi merged 1 commit into
developfrom
ci/labeler-pull-request-trigger

Conversation

@MarTrepodi

@MarTrepodi MarTrepodi commented Dec 5, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Every Auto Label PR run since December 2 has ended in a startup failure, so no pull request has been labeled by path since then. GitHub now blocks pull_request_target on public repositories by default, and this workflow was the only one here using that trigger.

Labeling does not need pull_request_target for pull requests opened from a branch in this repository, so the workflow moves to pull_request and the default protection stays in place.

Summary

 name: Auto Label PR
 on:
-  pull_request_target:
+  pull_request:
     types: [opened, synchronize]

 permissions:
   contents: read
   pull-requests: write

 jobs:
   label:
+    if: github.event.pull_request.head.repo.full_name == github.repository
     steps:
       - actions/checkout
       - actions/labeler

What each kind of pull request gets after this change:

Pull request from Token under pull_request Result
A branch in this repository read/write, from the permissions block labeled as before
Dependabot read-only by default, raised by the permissions block labeled as before
A fork always read-only job skipped; label by hand

Two of the 223 pull requests so far came from forks. Without the if, the labeler would fail on those instead of skipping.

One behaviour shift: under pull_request the workflow file and .github/labeler.yml come from the pull request's merge commit rather than the base branch, so a pull request that edits the label rules is labeled by its own new rules.

Related Issues

None.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Refactor (code change that neither fixes a bug nor adds a feature)
  • Performance improvement
  • Documentation
  • Tests
  • CI / build / dependencies

Checklist

  • This PR targets the develop branch (only release PRs target main)
  • My commits follow the Conventional Commits / Angular convention (feat:, fix:, refactor:, etc.) — they become the changelog
  • I have not edited CHANGELOG.md by hand (it is generated from commit messages)
  • I have added/updated docstrings with type hints for any new or changed public methods — not applicable, workflow file only
  • I have updated the docs (README.md, docs/, examples/) if user-facing behavior changed — not applicable
  • I have added unit tests that cover my changes (mocked, not requiring a live comlink service) — not applicable
  • Tests pass (uv run pytest tests/) — not run locally; no Python changed
  • Ruff linter and formatter pass (uv run ruff check src/ tests/ and uv run ruff format --check src/ tests/) — not run locally; no Python changed
  • Type check passes (uv run ty check src/swgoh_comlink/) — not run locally; no Python changed
  • I have not bundled unrelated changes in this PR

Testing

Merge Danger

Door: two-way

One workflow file. Reverting restores the old trigger, which GitHub would block again.

Blast Radius: labels

Only the path labels on pull requests are affected, and no other workflow or required check depends on them. Pull requests from forks stop being labeled automatically. Pull requests that target main stay unlabeled until main has this change, because their merge commit still carries the old workflow file.

🤖 Generated with Claude Code

GitHub now blocks pull_request_target on public repositories by default, so
every Auto Label PR run ended in a startup failure before any job was created.
Labeling does not need that trigger for pull requests opened from a branch in
this repository, so run on pull_request instead.

A pull request from a fork always gets a read-only token under pull_request,
so the job skips those rather than fail. They need labeling by hand.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@github-actions github-actions Bot added the ci Changes related to continuous integration processes label Dec 5, 2026
@MarTrepodi
MarTrepodi enabled auto-merge December 5, 2026 00:50
@MarTrepodi MarTrepodi self-assigned this Dec 5, 2026
@MarTrepodi
MarTrepodi disabled auto-merge December 5, 2026 00:59
@MarTrepodi
MarTrepodi merged commit eae4e96 into develop Dec 5, 2026
18 checks passed
@MarTrepodi
MarTrepodi deleted the ci/labeler-pull-request-trigger branch December 5, 2026 00:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Changes related to continuous integration processes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant