From 46f9b680285ebe6e76e68a1322063417bd9ef4b9 Mon Sep 17 00:00:00 2001 From: Andy Pan Date: Fri, 30 Jun 2023 20:30:36 +0800 Subject: [PATCH] chore: update the workflow of pull requests --- .github/workflows/pull-request.yml | 17 +++++++++++++++++ .github/workflows/test.yml | 2 ++ CONTRIBUTING.md | 2 +- 3 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/pull-request.yml diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml new file mode 100644 index 0000000..d5cf385 --- /dev/null +++ b/.github/workflows/pull-request.yml @@ -0,0 +1,17 @@ +name: Check pull request target +on: + pull_request_target: + types: + - opened + - reopened + - synchronize +jobs: + check-branches: + runs-on: ubuntu-latest + steps: + - name: Check target branch + run: | + if [ ${{ github.base_ref }} == "master" ] && [ ${{ github.head_ref }} != "dev" ]; then + echo "Only pull requests from dev branch are only allowed to be merged into master branch." + exit 1 + fi \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a01708c..0b4da1d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,6 +10,7 @@ on: - '.github/FUNDING.yml' - '.github/release-drafter.yml' - '.github/ISSUE_TEMPLATE/*' + - '.github/workflows/pull-request.yaml' - '.github/workflows/release-drafter.yaml' - 'examples/*' pull_request: @@ -21,6 +22,7 @@ on: - '.github/FUNDING.yml' - '.github/release-drafter.yml' - '.github/ISSUE_TEMPLATE/*' + - '.github/workflows/pull-request.yaml' - '.github/workflows/release-drafter.yaml' - 'examples/*' diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6911574..1ccea8e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -6,7 +6,7 @@ - Review existing issues and provide feedback or react to them. ## With pull requests: - - Open your pull request against `master`. + - Open your pull request against `dev`. - Open one pull request for only one feature/proposal, if you have several those, please put them into different PRs, whereas you are allowed to open one pull request with several bug-fixs. - Your pull request should have no more than two commits, if not, you should squash them. - It should pass all tests in the available continuous integrations systems such as TravisCI.