Skip to content

Commit

Permalink
[ci] Disallow PRs against builds branch (#32335)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
poteto authored Feb 7, 2025
1 parent 569c3b2 commit 7588b6b
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/shared_close_direct_sync_branch_prs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: (Shared) Close Direct Sync Branch PRs

on:
pull_request:
branches:
- builds/facebook-*

env:
TZ: /usr/share/zoneinfo/America/Los_Angeles
# https://github.com/actions/cache/blob/main/tips-and-workarounds.md#cache-segment-restore-timeout
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 1

jobs:
close_pr:
runs-on: ubuntu-latest
steps:
- name: Close PR
uses: actions/github-script@v7
with:
script: |
const owner = context.repo.owner;
const repo = context.repo.repo;
const pullNumber = ${{ github.event.number }};
await github.rest.pulls.createReview({
owner,
repo,
pull_number: pullNumber,
body: 'Do not land changes to `${{ github.event.pull_request.base.ref }}`. Please re-open your PR targeting `main` instead.',
event: 'REQUEST_CHANGES'
});
await github.rest.pulls.update({
owner,
repo,
pull_number: pullNumber,
state: 'closed'
});

0 comments on commit 7588b6b

Please # to comment.