Skip to content

[2.1] ci: run PR code on pull_request only and retire the safe to test label - #36403

Closed
pmbrull wants to merge 1 commit into
2.1from
pmbrull/retire-safe-to-test-2.1
Closed

pmbrull wants to merge 1 commit into
2.1from
pmbrull/retire-safe-to-test-2.1

Conversation

@pmbrull

@pmbrull pmbrull commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

Describe your changes:

Release-branch backport of #35426 to the newly created 2.1 branch. Merge this before #35426. No linked issue: the same CI hardening change, using skip-pr-checks as on the existing backports.

Converts workflows that execute PR code from pull_request_target to pull_request, removes the safe to test label gate and team labeler, and restricts secret-backed steps and PR writes to same-repository, non-Dependabot PRs. Forks receive job summaries and annotations. Metadata-only workflows retain pull_request_target without checking out PR code.

The 31-file change exactly matches source commit 74aa489b49c8b70a06b4215772f1834ca3bbb8e1 on every touched path, including the separate Playwright ingestion-image preparation job. Changes already present on 2.1, including the MSSQL CLI test matrix, remain intact.

Type of change:

  • Improvement

High-level design:

Uses the design and accepted decision in #35426 and ADR:2026-10-14-pr-code-never-runs-on-pull-request-target; the decision record is included in this backport.

pull_request reads the target branch's workflow copies. Preparing 2.1 before switching main prevents its PR checks from disappearing during rollout. Active release-line backports are 2.0 (#35433), 2.1 (this PR), and 1.13 (#35435). Future 2.0.x branches inherit the change from 2.0; already released patch branches need no independent backport. The old 2.0.5 PR #35434 is closed.

The main rollout still enables require_last_push_approval in merge-rules when #35426 lands. Until then, old main-owned pull_request_target runs may overlap the new pull_request runs and cancel one another; cancelled legacy runs may need a one-time rerun.

Tests:

Use cases covered

  • Same-repository PRs retain secret-backed integrations and bot comments.
  • Fork and Dependabot PRs run checks without the label gate, secrets, or PR writes.
  • Reusable Playwright fixture and ingestion-image jobs retain their dependencies and cache guards.

Unit tests

source env/bin/activate && python -m pytest .github/scripts/tests -q --tb=short: 328 passed, 5 failed. All five failures reproduce on unmodified origin/2.1: unavailable first-attempt metrics, Basic-project exclusions, schema-search tagging, summary-job condition, and retry-policy text. No new test failures.

Backend integration tests

Not applicable: no Java, schema, migration, or backend API changes.

Ingestion integration tests

Not applicable: no ingestion implementation changes.

Playwright (UI) tests

Not run: no UI implementation changes. Existing CI script tests cover workflow planning, cache assets, merge-group validation, and summary redaction.

Manual testing performed

  1. Parsed all 22 changed YAML files.
  2. Ran actionlint on all 20 changed workflows against the 2.1 baseline: 9 existing findings before and after; zero new findings.
  3. Verified no workflow opts into unsafe PR checkout, retains the label gate, or checks out code under pull_request_target.
  4. Verified all 29 added/modified files match the source PR exactly; both deletions match too.
  5. node --check .github/scripts/render_playwright_summary.cjs, the decision-record checker, git diff --check, and commit hooks passed.

UI screen recording:

Not applicable: CI configuration only.

Checklist:

  • I have read the CONTRIBUTING document.
  • Issue-number title and linked issue: not applicable; CI-hardening backport of ci: run PR code on pull_request only and retire the safe to test label #35426, labelled skip-pr-checks like the existing backports.
  • Comments explain non-obvious behavior inherited from the source PR.
  • JSON Schema changes: not applicable.
  • UI feature recording: not applicable.
  • Relevant tests and actual results are listed above.
  • Self-review against REVIEW.md: fresh-context review of commit 055c21981d713b3b0aaecaac6ff3108143e20032 found no blockers. Target-branch local references and Collate 2.1 dispatch compatibility were verified; static-only CI coverage is inherited from the accepted source change.
  • Decision check: follows and includes the accepted decision from ci: run PR code on pull_request only and retire the safe to test label #35426.

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge under the stated rollout plan.

Summary

Moves PR-code workflows to pull_request, removes the safe to test gate, and retires the team labeler.

  • PR checks run from the PR merge commit, with secret-backed steps limited to eligible same-repository runs.
  • The merge queue runs Collate work skipped for fork and Dependabot pull requests.
  • Fork pull requests get instructions to update generated TypeScript files themselves.

Acknowledged rollout decisions:

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  PR[PR opened or updated] --> Checks[Run code with pull_request]
  Checks --> Origin{Same repository and not Dependabot?}
  Origin -->|Yes| Integrations[Allow secret-backed steps and PR comments]
  Origin -->|No| Summary[Checks and job summaries without privileged writes]
  Summary --> Queue[Merge queue]
  Queue --> Fallback[Run deferred Collate and data-access checks]
Loading

Reviews (1) · Last reviewed commit: "ci: backport PR workflow hardening to 2...." · Reviewed by Greptile

@pmbrull pmbrull added the skip-pr-checks Bypass PR metadata validation check label Oct 28, 2026
@pmbrull
pmbrull requested review from a team, akash-jain-10, harshach and tutte as code owners October 28, 2026 07:00
@github-actions github-actions Bot added Ingestion safe to test Add this label to run secure Github workflows on PRs labels Oct 28, 2026
@gitar-bot

gitar-bot Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Code Review ✅ Approved

🔴 High risk · Moving 31 CI workflows to pull_request and revising secret/write gates could expose credentials or disrupt required checks if trust conditions misfire.

Backports the CI hardening from #35426 to the 2.1 release branch, moving PR code execution from pull_request_target to pull_request, removing the safe to test label gate, and restricting secret-backed steps and PR writes to same-repository, non-Dependabot PRs. No issues found.

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

Auto-approval Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Display: compact → Showing compact verification results.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Ingestion safe to test Add this label to run secure Github workflows on PRs skip-pr-checks Bypass PR metadata validation check

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants