-
-
Notifications
You must be signed in to change notification settings - Fork 0
48 lines (36 loc) · 1.16 KB
/
branch-status-check.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
name: ✅Branch Status Check
defaults:
run:
shell: pwsh
on:
workflow_dispatch:
pull_request:
branches: main
jobs:
branch_status_check:
name: PR Branch Status Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Deno
uses: denoland/setup-deno@v1
with:
deno-version: ${{ vars.DENO_VERSION }}
- name: Validate Branch
run: |
$targetBranch = "${{ github.base_ref }}";
$srcBranch = "${{ github.head_ref }}";
$featureBranchRegex = "";
$dependatobt
# Validate the source branch
if ($srcBranch -notmatch "${{ vars.FEATURE_BRANCH_REGEX }}" -and $srcBranch -notmatch "${{ vars.RENOVATE_BRANCH_REGEX }}") {
$errorMsg = "::error::The source branch name '$srcBranch' is invalid.";
$errorMsg += "`nIt must match the regex '${{ vars.FEATURE_BRANCH_REGEX }}' or '${{ vars.RENOVATE_BRANCH_REGEX }}'";
Write-Host $errorMsg;
exit 1;
}
# Validate the target branch
if ($targetBranch -ne "main") {
Write-Host "::error::The target branch must be 'main'";
exit 1;
}