From: Richard Si <63936253+ichard26@users.noreply.github.com> Date: Sat, 31 Dec 2022 06:52:35 +0000 (-0500) Subject: Fail lint CI if the PR doesn't target main (#3477) X-Git-Url: https://git.madduck.net/etc/vim.git/commitdiff_plain/37542e64855ce21bd580f973ae5ce1ed86812a7a?ds=inline 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. --- diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 90c4801..064d474 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -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: