From be284abf705796d7299bf1ebcf536d0237a92421 Mon Sep 17 00:00:00 2001 From: ByteLegendBot Date: Mon, 12 Jun 2023 13:06:11 +0800 Subject: [PATCH] Sync by bot --- .github/workflows/check.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 10429ea..e8e9767 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -14,6 +14,14 @@ jobs: persist-credentials: false ref: main fetch-depth: 0 + - name: Validate PR branch name + uses: actions/github-script@v5 + with: + script: | + const branchName = context.payload.pull_request.head.ref; + if (!/^[\w/-]*$/.test(branchName)) { + throw new Error(`Invalid branch name: ${branchName}`); + } - name: Checkout PR branch run: | git remote add pr ${{ github.event.pull_request.head.repo.html_url }}