File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Build and test
2+
3+ on :
4+ workflow_dispatch :
5+ workflow_call :
6+
7+ jobs :
8+ build :
9+ name : " Build and test"
10+
11+ runs-on : ubuntu-latest
12+
13+ strategy :
14+ matrix :
15+ node-version : [16.x, 18.x, 20.x]
16+
17+ steps :
18+ - name : Check out Git repository
19+ uses : actions/checkout@v4
20+
21+ - name : Use Node.js ${{ matrix.node-version }}
22+ uses : actions/setup-node@v3
23+ with :
24+ node-version : ${{ matrix.node-version }}
25+ cache : " npm"
26+ - run : npm ci
27+ - run : npm run build --if-present
28+ - run : npm test
Original file line number Diff line number Diff line change 55 workflow_call :
66 push :
77 branches : ["main", "dev"]
8- pull_request :
9- branches : ["main", "dev"]
108
119jobs :
1210 lint :
1513 build :
1614 name : " Build and test"
1715 needs : lint
18-
19- runs-on : ubuntu-latest
20-
21- strategy :
22- matrix :
23- node-version : [16.x, 18.x, 20.x]
24-
25- steps :
26- - name : Check out Git repository
27- uses : actions/checkout@v4
28-
29- - name : Use Node.js ${{ matrix.node-version }}
30- uses : actions/setup-node@v3
31- with :
32- node-version : ${{ matrix.node-version }}
33- cache : " npm"
34- - run : npm ci
35- - run : npm run build --if-present
36- - run : npm test
16+ uses : ./.github/workflows/buildAndTest.yaml
Original file line number Diff line number Diff line change 1+ name : Pull Request
2+
3+ on :
4+ workflow_dispatch :
5+ workflow_call :
6+ pull_request :
7+ types :
8+ - opened
9+ - edited
10+ - synchronize
11+ - reopened
12+
13+ jobs :
14+ check-target-branch :
15+ runs-on : ubuntu-latest
16+
17+ steps :
18+ - name : Check if PR targets a protected branch
19+ run : |
20+ PROTECTED_BRANCH="main"
21+ if [ "${{ github.event.pull_request.base.ref }}" == "$PROTECTED_BRANCH" ]; then
22+ echo "Pull requests to $PROTECTED_BRANCH are not allowed."
23+ exit 1
24+ fi
25+ echo "Pull request target is allowed."
26+ development :
27+ name : " Development workflow"
28+ needs : check-target-branch
29+ uses : ./.github/workflows/dev.yaml
You can’t perform that action at this time.
0 commit comments