Fail lint CI if the PR doesn't target main (#3477)

Let's skip the check if we're running on a fork just in case someone
opens a PR against a branch on said fork as part of a PR review
upstream.
This commit is contained in:
Richard Si 2022-12-31 01:52:35 -05:00 committed by GitHub
parent 4e3303fa08
commit 37542e6485
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -16,6 +16,13 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Assert PR target is main
if: github.event_name == 'pull_request' && github.repository == 'psf/black'
run: |
if [ "$GITHUB_BASE_REF" != "main" ]; then
echo "::error::PR targeting '$GITHUB_BASE_REF', please refile targeting 'main'." && exit 1
fi
- name: Set up latest Python
uses: actions/setup-python@v4
with: