Skip to content

Commit 86099bd

Browse files
authored
ci(governance): harden pull_request_target governance workflow (#105)
1 parent 48e173b commit 86099bd

1 file changed

Lines changed: 41 additions & 17 deletions

File tree

‎.github/workflows/governance.yml‎

Lines changed: 41 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,56 @@
1+
# Copyright 2026 UCP Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
115
---
216
name: PR Governance
317

4-
on:
18+
# pull_request_target is required so the validator can read team memberships via
19+
# ORG_READ_TOKEN on PRs from forks and post the Governance / Approvals commit
20+
# status, while workflow_run re-evaluates when a review is submitted. No
21+
# PR-authored code is checked out or executed: the reusable workflow only reads
22+
# PR metadata via the GitHub API.
23+
on: # zizmor: ignore[dangerous-triggers]
524
pull_request_target:
6-
types: [
7-
opened,
8-
synchronize,
9-
reopened,
10-
ready_for_review,
11-
review_requested,
12-
review_request_removed,
13-
assigned,
14-
unassigned
15-
]
25+
branches:
26+
- main
27+
- "release/**"
28+
types:
29+
- opened
30+
- synchronize
31+
- reopened
32+
- ready_for_review
33+
- review_requested
34+
- review_request_removed
35+
- assigned
36+
- unassigned
1637
workflow_run:
1738
workflows: ["PR Review Listener"]
1839
types: [completed]
1940

41+
permissions: {}
42+
2043
jobs:
2144
governance:
2245
name: Reviews
2346
permissions:
24-
statuses: write
25-
contents: read
26-
pull-requests: read
27-
# Use the reusable workflow defined in the central governance repository
28-
# zizmor: ignore[ref-confusion]
29-
uses: Universal-Commerce-Protocol/.github/.github/workflows/reusable-governance.yml@main
47+
statuses: write # Post the Governance / Approvals commit status
48+
# Reusable workflow from the central governance repository, hash-pinned per
49+
# the org's unpinned-uses policy. This pins only the orchestration: the
50+
# workflow checks out Universal-Commerce-Protocol/.github at ref: main, so
51+
# the rules file and validator scripts are always read from its default
52+
# branch. Governance rule changes apply without bumping this pin.
53+
uses: Universal-Commerce-Protocol/.github/.github/workflows/reusable-governance.yml@97682ca4ad40b4321d60bb58c869e12f19a8bcae # main
3054
with:
3155
pr-number: ${{ github.event.pull_request.number }}
3256
commit-sha: ${{ github.event.pull_request.head.sha || github.event.workflow_run.head_sha }}

0 commit comments

Comments
 (0)