Skip to content

pr.yaml: trust Dependabot in Protected File Check guard#101

Merged
Chris-Wolfgang merged 1 commit into
mainfrom
fix/protected-file-check-trust-dependabot
May 13, 2026
Merged

pr.yaml: trust Dependabot in Protected File Check guard#101
Chris-Wolfgang merged 1 commit into
mainfrom
fix/protected-file-check-trust-dependabot

Conversation

@Chris-Wolfgang
Copy link
Copy Markdown
Owner

@Chris-Wolfgang Chris-Wolfgang commented May 13, 2026

Summary

The check-protected-files job (status name Protected File Check) unconditionally fails on any change to protected config files, with no exemption for Dependabot. That blocks every Dependabot PR that bumps an analyzer version (since analyzer PackageReference lives in Directory.Build.props), forcing a maintainer override to merge what should be a hands-off auto-merge.

Fix

Adds the standard Dependabot guard to the job-level if::

if: |
  github.repository != 'Chris-Wolfgang/repo-template' &&
  github.event.pull_request.user.login != 'dependabot[bot]'

Required status checks treat skipped jobs as passing, so once this lands, Dependabot PRs whose only protected-file change is an analyzer-version bump will turn green on this check.

Why this is safe

  • The threat model is human PR authors disabling analyzers in their own PRs. Dependabot is GitHub-controlled and not spoofable; its only action is package-version updates.
  • The branch-ruleset still requires the check; Dependabot's "skipped" simply counts as pass.

Note on pattern consistency

This pr.yaml variant centralizes all protected-file guarding in the standalone check-protected-files job — there are no inline per-job guards to align with here (newer template revisions in other repos do have inline guards, each carrying the same Dependabot exemption; this PR brings the centralized-guard variant up to the same effective behavior).

Test plan

The `check-protected-files` job (job name "Protected File Check")
unconditionally fails on any modification to .editorconfig,
Directory.Build.props, Directory.Build.targets, BannedSymbols.txt,
*.globalconfig, or *.ruleset — without exempting Dependabot.

That means Dependabot PRs that bump analyzer versions in
Directory.Build.props (the canonical place for analyzer
PackageReferences) get blocked by this guard and require a maintainer
override to merge, defeating the auto-merge story for
package-version bumps.

Every other protected-files guard in this workflow (inline ones in
detect-projects, test-linux-core, test-windows, test-macos) already
carries `if: github.event.pull_request.user.login != 'dependabot[bot]'`.
This change brings the standalone job in line with that pattern by
short-circuiting at the job level.

Required status checks treat skipped jobs as passing, so blocked
Dependabot PRs will turn green after this lands.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 13, 2026 00:05
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 updates the repository’s PR validation workflow to stop the Protected File Check job from blocking Dependabot PRs that legitimately modify protected configuration files (e.g., analyzer PackageReference updates in Directory.Build.props).

Changes:

  • Add a Dependabot exemption to the check-protected-files job-level if: condition.
  • Add explanatory comments documenting the rationale and expected branch-ruleset behavior for skipped jobs.

Comment thread .github/workflows/pr.yaml
@Chris-Wolfgang Chris-Wolfgang merged commit 428ca26 into main May 13, 2026
13 checks passed
@Chris-Wolfgang Chris-Wolfgang deleted the fix/protected-file-check-trust-dependabot branch May 13, 2026 00:36
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.

2 participants