Skip to content

Commit

Permalink
Fail lint CI if the PR doesn't target main (psf#3477)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ichard26 authored Dec 31, 2022
1 parent 4e3303f commit 37542e6
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 37542e6

Please sign in to comment.