|
| 1 | +# Temporary PR gate (Adam, 2026-06-09): outside pull requests are paused while |
| 2 | +# we work through a backlog. Only the allowlisted contributors can open PRs; |
| 3 | +# everyone else is asked to open an issue instead and the PR is closed. Issues |
| 4 | +# stay fully open. This workflow auto-disables itself after EXPIRY, so the |
| 5 | +# restriction lifts on its own with no further action. |
| 6 | +# |
| 7 | +# Uses pull_request_target so it has a token that can comment/close on PRs from |
| 8 | +# forks. It never checks out or runs PR code, so this is safe. |
| 9 | +name: PR gate |
| 10 | + |
| 11 | +on: |
| 12 | + pull_request_target: |
| 13 | + types: [opened, reopened] |
| 14 | + |
| 15 | +permissions: |
| 16 | + pull-requests: write |
| 17 | + issues: write |
| 18 | + |
| 19 | +jobs: |
| 20 | + gate: |
| 21 | + runs-on: ubuntu-latest |
| 22 | + steps: |
| 23 | + - uses: actions/github-script@v7 |
| 24 | + with: |
| 25 | + script: | |
| 26 | + const EXPIRY = '2026-06-16'; // restriction lifts after this date (UTC) |
| 27 | + const ALLOW = ['ilanoh', 'adrida']; // may open PRs while gated |
| 28 | + const today = new Date().toISOString().slice(0, 10); |
| 29 | + if (today > EXPIRY) { |
| 30 | + core.info(`PR gate expired (${EXPIRY}); allowing all PRs.`); |
| 31 | + return; |
| 32 | + } |
| 33 | + const author = context.payload.pull_request.user.login; |
| 34 | + if (ALLOW.includes(author)) { |
| 35 | + core.info(`${author} is allowlisted; PR allowed.`); |
| 36 | + return; |
| 37 | + } |
| 38 | + const { owner, repo } = context.repo; |
| 39 | + const number = context.payload.pull_request.number; |
| 40 | + await github.rest.issues.createComment({ |
| 41 | + owner, repo, issue_number: number, |
| 42 | + body: [ |
| 43 | + `Thanks for wanting to contribute, @${author}.`, |
| 44 | + ``, |
| 45 | + `We're pausing outside pull requests for about a week while we work through a backlog.`, |
| 46 | + `Please open an **issue** describing the change and we'll pick it up there.`, |
| 47 | + ``, |
| 48 | + `Pull requests reopen to everyone after ${EXPIRY}.`, |
| 49 | + ].join('\n'), |
| 50 | + }); |
| 51 | + await github.rest.pulls.update({ owner, repo, pull_number: number, state: 'closed' }); |
| 52 | + core.info(`Closed PR #${number} from non-allowlisted author ${author}.`); |
0 commit comments