Skip to content

Commit 7588b6b

Browse files
authored
[ci] Disallow PRs against builds branch (facebook#32335)
Our internal build infra relies on a 1:1 mapping between `main` and the 2 build branches. Directly committing changes to those branches breaks that infra. Adds a simple workflow to leave a comment and decline the PR.
1 parent 569c3b2 commit 7588b6b

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: (Shared) Close Direct Sync Branch PRs
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- builds/facebook-*
7+
8+
env:
9+
TZ: /usr/share/zoneinfo/America/Los_Angeles
10+
# https://github.com/actions/cache/blob/main/tips-and-workarounds.md#cache-segment-restore-timeout
11+
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 1
12+
13+
jobs:
14+
close_pr:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Close PR
18+
uses: actions/github-script@v7
19+
with:
20+
script: |
21+
const owner = context.repo.owner;
22+
const repo = context.repo.repo;
23+
const pullNumber = ${{ github.event.number }};
24+
25+
await github.rest.pulls.createReview({
26+
owner,
27+
repo,
28+
pull_number: pullNumber,
29+
body: 'Do not land changes to `${{ github.event.pull_request.base.ref }}`. Please re-open your PR targeting `main` instead.',
30+
event: 'REQUEST_CHANGES'
31+
});
32+
await github.rest.pulls.update({
33+
owner,
34+
repo,
35+
pull_number: pullNumber,
36+
state: 'closed'
37+
});

0 commit comments

Comments
 (0)