new workflow which restricts pull request from any other branch except dev-cloud and main

This commit is contained in:
Ronald A. Richardson
2023-08-03 13:01:03 +08:00
parent aea4b781b8
commit 04b01c734d

18
.github/workflows/cloud.yml vendored Normal file
View File

@@ -0,0 +1,18 @@
name: "Close Invalid PRs"
on:
pull_request:
branches:
- cloud
jobs:
close_pr:
runs-on: ubuntu-latest
steps:
- name: Close invalid PRs
run: |
if [[ "${{ github.event.pull_request.head.ref }}" != "main" ]] && [[ "${{ github.event.pull_request.head.ref }}" != "dev-cloud" ]]; then
echo "This PR is from '${{ github.event.pull_request.head.ref }}', but only PRs from 'main' or 'dev-cloud' are allowed. Closing PR."
gh pr close ${{ github.event.pull_request.number }} --repo ${{ github.repository }}
fi
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}