forked from supabase/cli
-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (69 loc) · 2.78 KB
/
Copy pathcontribution-gate.yml
File metadata and controls
74 lines (69 loc) · 2.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
name: Contribution Gate
on:
pull_request_target:
types:
- opened
- reopened
- edited
# Manual sweep over every open PR — e.g. after bulk-applying the
# `open-for-contribution` label. Set `dry_run` to log decisions without
# commenting or closing.
workflow_dispatch:
inputs:
dry_run:
description: "Evaluate and log decisions only; do not comment or close"
type: boolean
default: false
permissions:
pull-requests: write
issues: read
contents: read
concurrency:
# Per-PR for pull_request_target; unique per run for manual sweeps (which
# carry no pull_request payload) so two sweeps never cancel each other.
group: contribution-gate-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: true
jobs:
gate-single:
name: Contribution Gate
runs-on: ubuntu-latest
# Exempt maintainers/collaborators and bots. External contributors are gated.
if: >
github.event_name == 'pull_request_target' &&
github.event.pull_request.author_association != 'OWNER' &&
github.event.pull_request.author_association != 'MEMBER' &&
github.event.pull_request.author_association != 'COLLABORATOR' &&
github.event.pull_request.user.type != 'Bot'
steps:
# Checks out the base repo (default for pull_request_target), so the gate
# runs trusted code from the base branch, never the untrusted PR head.
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
with:
bun-version: "1.3.13"
- name: Evaluate contribution gate
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REPOSITORY: ${{ github.repository }}
PR_NUMBER: ${{ github.event.pull_request.number }}
PR_AUTHOR_ASSOCIATION: ${{ github.event.pull_request.author_association }}
PR_AUTHOR_TYPE: ${{ github.event.pull_request.user.type }}
run: bun .github/scripts/contribution-gate.ts
gate-all:
name: Contribution Gate (all open PRs)
runs-on: ubuntu-latest
if: github.event_name == 'workflow_dispatch'
steps:
# Base-branch checkout only — the sweep makes API calls and never runs
# any PR's code.
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
with:
bun-version: "1.3.13"
- name: Evaluate contribution gate across all open PRs
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REPOSITORY: ${{ github.repository }}
GATE_MODE: all
DRY_RUN: ${{ inputs.dry_run || 'false' }}
run: bun .github/scripts/contribution-gate.ts